my dog learned polymorphism*
The moose likes Struts and the fly likes Passing an object between actions. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing an object between actions." Watch "Passing an object between actions." New topic
Author

Passing an object between actions.

Muthukrishnan Manoharan
Ranch Hand

Joined: Aug 27, 2008
Posts: 91

Hi,
I have an object created in action class (action1) as a result of user entering details in a form (say form1).
Now I have next form as form2 where user enters some more details for that object.
Initially I put the object created during action1 into the request scope. Now i would like to know how will i retrieve the object at form2 and pass it on to action2 using struts tag, so that I can add some more details to the same object as given by the user in the form2.

I am sorry if I am not clear with my explanations. Please tell me if I should rephrase it..

Thanks,
Muthu
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You either need to save the first form in session (or a data transfer object) or use hidden form fields.
Muthukrishnan Manoharan
Ranch Hand

Joined: Aug 27, 2008
Posts: 91

First thanks a lot for the reply.

Can you please elaborate me how I can do that.
For example if I am storing the object in session in the form1 action(ie action1), I would like to know how I can access that object in form2.jsp using struts tag and pass it to the form2 action..

And one more thing - Can I use hidden field for custom objects.

Thanks,
Muthu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing an object between actions.