File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:getProperty

 
Madhu Sudhana
Ranch Hand
Posts: 127
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Sandeep Chhabra
Ranch Hand
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think the answer 1 is also correct correct me if I am wrong...


No 1 is not correct.
<jsp:getProperty Name="id" Property="streetName"/>

There is no attribute as Name, infact it is name.

Case does matters!!!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic