This is the one of the mock exam question with explaination...
Which of the following are valid declarations in a
JSP page? [Check all correct answers]
1. <jsp:getProperty Name="id" Property="streetName"/>
2. <jsp:getProperty property="streetName" name="id"></jsp:getProperty>
3. <jsp:getProperty name="id" class="com.baboon.scwcd.Address" property="streetName"/>
4. <jsp:getProperty name="id" property="streetName"/>
5. <jsp:getProperty property="streetName" name="id"/>
You have answered: 2 4 5 - This is incorrect
Answer 4 and 5 are correct.
The JSP tag getProperty has 2 mandatory attributes. The attribute "name" refers to the
Java bean instance from which the required property will be obtained.
The attribute "property" is the name of the property, it is the value stored in this property that will be retrieved.
Answer 3 is incorrect, the attribute class is invalid for the getProperty tag.
Your Java bean must comply to the Java Beans specifications, the property to be retrieved must have the appropriate getters and setters implemented in the Java Bean.
I think the answer 1 is also correct correct me if I am wrong...