This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Getting multiple properties from jsp:usebean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting multiple properties from jsp:usebean" Watch "Getting multiple properties from jsp:usebean" New topic
Author

Getting multiple properties from jsp:usebean

Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
Hello all,
I though I remember reading that you can get nested properties in a java bean using the jsp:useBean tag.
For example, if I have a "Container" bean which contains a "Person" bean which then has a name property, I could retrieve it by using...
...
<jsp:getProperty name="Container" property="person.name"/>
...
This would then translate to
Container.getPerson().getName()
I could be totally wrong here. (Which would explain why I haven't seen any documentation on this) But if I am half right, could someone point me out to some documentation that illustrates this?
Regards,
Joshua
[ March 08, 2003: Message edited by: Joshua White ]
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
Correct me if I am wrong but I don't think the
getProperty tag is designed to work that way.
I believe the property element contained in the getProperty tag must relate to the name of a get method defined in your bean.
for example getProperty property="address" implies you have defined a method called getAddress() in your bean.
Also for example if you have setProperty property="*" will
assign all your setter methods based on your html
elements.
Craig
Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
Figured it out!
This was a STRUTS thing. Using the struts bean tags, you can access nested properties.
 
Don't get me started about those stupid light bulbs.
 
subject: Getting multiple properties from jsp:usebean
 
Similar Threads
jsp:setProperty without jsp:useBean
Turning a form-property into a bean on a JSP
"target" version of c:set
JSP / Bean prob.
Head First Servlets and JSP:SCWCD Question