jQuery in Action, 3rd edition
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:getProperty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp:getProperty" Watch "jsp:getProperty" New topic


Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
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...

"And the trouble is, if you don't risk anything, you risk even more." -- Erica Jong.
Sandeep Chhabra
Ranch Hand

Joined: Aug 28, 2005
Posts: 340

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!!!

Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
I agree. Here's the link: http://aspose.com/file-tools
subject: jsp:getProperty
It's not a secret anymore!