aspose file tools*
The moose likes Struts and the fly likes Data across multiple actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Data across multiple actions" Watch "Data across multiple actions" New topic
Author

Data across multiple actions

Shibin Paul
Greenhorn

Joined: Dec 11, 2006
Posts: 18
Is it possible to use the same ActionForm across multiple actions?
How do you get the data into another action which is not part of the original action mapping in struts-config file?

Thanks in advance
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Shibin Paul:
Is it possible to use the same ActionForm across multiple actions?
Yes, it is. Just refer to the same form-bean name in each action mapping.
Originally posted by Shibin Paul:
How do you get the data into another action which is not part of the original action mapping in struts-config file?

Suppose you have just submitted a form to an action that uses ActionForm1 and you want to pass the value of the property foo to another page that uses ActionForm2. The following code would do the job.

[ May 07, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Shibin Paul
Greenhorn

Joined: Dec 11, 2006
Posts: 18
The problem is there is a user form which the user fills when he hits the submit button it moves to the confirmation page on which there is a ok button.When you hit the ok button the data should fill a database.I am using the same actionForm across.Problem occurs when I try to populate the database the user DataForm gets reset.So how do you get the data across.I am using the request scope.

Thank you
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
Use hidden form fields to save the data.
Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
You mean that the data is lost after submitting the confirmation screen ?
If this is the case you might want to use the session scope instead of the request...

Hope this helps
Shibin Paul
Greenhorn

Joined: Dec 11, 2006
Posts: 18
Thanks Dom Lassy and Kristof Camelbeke.
It helped solve the problem.
 
 
subject: Data across multiple actions