File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:getProperty and jsp:setProperty 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 and jsp:setProperty" Watch "jsp:getProperty and jsp:setProperty" New topic

jsp:getProperty and jsp:setProperty

parra matta
Ranch Hand

Joined: Mar 23, 2006
Posts: 40

On Page 1-108 of JSP Spec, it says:

The value of the name attribute in jsp:setProperty and jsp:getProperty will
refer to an object that is obtained from the pageContext object through its findAttribute method.

findAttribute will try to locate the attribute in page, request, session and application objects. And that means as long as the value of the name attribute in jsp:setProperty and jsp:getProperty refers to an attribute in any of the four objects, jsp:setProperty and jsp:getProperty will succeed without using jsp:useBean (assume that there is only one attribute with that name). I tested it in Tomcat 5.5.12 and it worked.

Does tomcat violate the spec? Can someone explain this to me.

Deepak Jetha

Joined: Mar 07, 2006
Posts: 5
That is funny, I was just about to ask the exact question. I was confused by the final mock exam in the HFSJ #63, where it has a jsp:setproperty, without a usebean, and it said it was fine. I thought you MUST have a js;:usebean also??

---------------------------------<br />SCJP 1.4 <br />SCWCD 1.4<br />FCP = FileNet Certified Professional
singh santosh
Ranch Hand

Joined: Jan 13, 2006
Posts: 136
hi ,
i hope this will be useful

I agree. Here's the link:
subject: jsp:getProperty and jsp:setProperty
It's not a secret anymore!