Two Laptop Bag*
The moose likes Struts and the fly likes Showing two properties from different beans on same .jsp page in Struts 1 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 » Frameworks » Struts
Bookmark "Showing two properties from different beans on same .jsp page in Struts 1" Watch "Showing two properties from different beans on same .jsp page in Struts 1" New topic
Author

Showing two properties from different beans on same .jsp page in Struts 1

Robert Wiscup
Ranch Hand

Joined: Oct 18, 2009
Posts: 45
Hi All,

I'm a little confused on how to show two properties from different beans on the same .jsp page.

I have a .jsp page in a Struts 1 application . . . code follows:




"description" is in the "ProblemDescription" Bean and "problemResolution" is in the "Problem" Bean.

The action mapping for this page is shown below:




Note that the "name" attribute points to "ProblemDescriptionForm" and not "ProblemForm"

When I try to load the page I get "No getter method available for property problemResolution for bean under name org.apache.struts.taglib.html.BEAN"

I assume I'm getting this because the action mapping uses name = "ProblemDescriptionForm" and not "ProblemForm" and "problemResolution" is part of the "ProblemForm".

So I'm confused as to how I show properties from two different beans on the same .jsp page when the name attribute in the action mapping can only point to one form (i.e. bean). Can someone explain how this is supposed to work?

Thanks in Advance,

Rob



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You put the bean into scope (generally request scope). Or you put the other bean you're talking about into the form bean.
Robert Wiscup
Ranch Hand

Joined: Oct 18, 2009
Posts: 45
Thanks for that David . . . everything is working now . . .

Thanks Again,

Rob
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Showing two properties from different beans on same .jsp page in Struts 1