aspose file tools*
The moose likes JSP and the fly likes doubt from jsp:setProperty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "doubt from jsp:setProperty" Watch "doubt from jsp:setProperty" New topic
Author

doubt from jsp:setProperty

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
The object named by the name must have been “introduced” to the JSP
processor using either the jsp:useBean action or a custom action with an
associated VariableInfo entry for this name.
Note: a consequence of the previous paragraph is that objects that are stored
in, say, the session by a front component are not automatically visible to jsp:set-
Property and jsp:getProperty actions in that page unless a jsp:useBean action, or
some other action, makes them visible.

what does the above mean ..anyone with a simple example
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
Where does the above text come from? I could store a bean as an attribute in PageContext and then access it using <jsp:getProperty> tag later. No <jsp:useBean> or VariableInfo involved ...
It works on Tomcat 4.0 at least ...


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
OK, I guess Tomcat does not exactly conform to the specification. I run my above mentioned code in resin and it would not run.
I think jsp:useBean does two things:
1. Put the bean instance into PageContext with ID attribute and the given scope;
2. Export the bean instance to a script variable with the name given in ID attribute.
If you want to write your own useBean tag, you need to do both. The first is quite easy. You can export the script variable using <variable> element in the tag's tld.
 
Don't get me started about those stupid light bulbs.
 
subject: doubt from jsp:setProperty