Which is true?

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?

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?

A.
the page will include the output false

B.
the page will include the output

C.
the page will report that the property roasted does not exist

D.
the page will report that the syntax of the useBean tag is incorrect

E.
the page will report that the syntax of the getProperty tag ls incorrect

Explanation:
http://www.emacao.gov.mo/documents/18/06/exam.pdf (4th table from the top)



Leave a Reply 9

Your email address will not be published. Required fields are marked *


giuseppe

giuseppe

A

sc0r

sc0r

Why A? Miss the method getRoasted() in the Bean and then cause an error in build.xml (in my Laptop). I think is E.

giuseppe

giuseppe

even if there are typo in so it could be syntiax error for both, but the answer is only one…

dreamer

dreamer

org.apache.jasper.JasperException: /index.jsp (line: 25, column: 13) Invalid standard action.
I go for E.

bob

bob

@dreamer
These questions dumps have lot of mistakes (bad OCR or badly typed by some human)
you can see a “returned” statement. That is not the kind of trap that are in actual Oracle questions.
You can’t just do Copy-Paste to test it.
Quite often, you have to use your judgement to correct obvious mistakes.
here the typos are :
the “returned”; the slash and backslash at end of tags; the mispelled “getProprty”

Allan Santos

Allan Santos

Besides the many typo. to call roasted value the method should be getRoasted() not isRoasted because the roasted attribute is Boolean and not boolean.

Neo

Neo

A

Because, controller created a bean instance and put it in application scope. When we use useBean with page scope it creates another bean and put it in page scope. The default value for “roasted” ise false. So the page will include the output false.