Question 3
Given the JavaBean class:
public class MyBean {
private Boolean roasted = false;
public MyBean ()
public Boolean isRoasted () { returned roasted }
public void setRoasted (Boolean roasted) { this.roasted = roasted; ]
}
Assume a controller has created an instance of this bean, called setRoasted (true), and inserted the bean into the application scope using the name “myBean”.
A JSP contains these two tags:
<jsp: useBean id = “aBean” class = “MyBean” scope = “page” \ />
<jsp: getProprty name = “aBean” property = “roasted” \ />
Which is true?
the page will include the output false
the page will include the output
the page will report that the property roasted does not exist
the page will report that the syntax of the useBean tag is incorrect
the page will report that the syntax of the getProperty tag ls incorrect
Correct answer: A
Explanation:
Reference: http://www.emacao.gov.mo/documents/18/06/exam.pdf (4th table from the top)
Reference: http://www.emacao.gov.mo/documents/18/06/exam.pdf (4th table from the top)