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 how do i pass a bean object from one JSP page to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how do i pass a bean object from one JSP page to another" Watch "how do i pass a bean object from one JSP page to another" New topic
Author

how do i pass a bean object from one JSP page to another

kay lin
Ranch Hand

Joined: May 20, 2004
Posts: 132
Hi All:
I would like to know how do I pass a bean from one JSP page to another what I mean is the following,
I have one jsp page called transaction.jsp and here is the code, the transaction.jsp page
gets the bean from a previous jsp page, here is the code


now, what I want to do is put a link that says "printer friendly version" so people can print off this transaction.jsp page
if they want, so I am thinking I just needs to add the following code to transaction.jsp


now my questions is will that actually send the actual bean object to the printer friendly page? what is the method of sending
one javaBean from one JSP page to another using STRUTS, because I am thinking in my printable.jsp page, I want to use the bean tags as well, like.
<bean:write name='detailsForm' property='transactionType'/> ...etc,

can some body help me out here?

I'd really appreciate your help..

Many thanks.
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
If you are passing beans around from JSP to JSP, and you are having your JSPs call each other directly, you are defeating the purpose of Struts and MVC. All requests should go through the Struts controller and map to Actions. Your Actions should place any necessary objects into scope for the JSPs to access. So if you want a "printer friendly version" of your data, you should link to something like /viewPrinterFriendly.do which maps to some Action which in turn places any beans you need into the proper scope, displaying the correct printer friendly view which can access those beans.

Your JSPS should never link to another JSP in your application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do i pass a bean object from one JSP page to another
 
Similar Threads
bean value persists on clicking back
HTML tag
How to Introduce a Button That Controls All Other Links in a Web Page
Problem in SessionManagement in Struts
Making a bean collected from a collection in a page, available in a subsequent page