File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Showing two properties from different beans on same .jsp page in Struts 1
 
Similar Threads
Displaying Data From Different Tables in .jsp
Struts: Getting a blank page instead of the form
ServletException in:/pages/logon.jsp] Cannot retrieve definition for form bean null'
Cannot retrieve mapping for action /content/AddLinks
ClassCastException in struts - urgent! :(