aspose file tools*
The moose likes Struts and the fly likes How to set actionForm initial values from session attributes 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 "How to set actionForm initial values from session attributes" Watch "How to set actionForm initial values from session attributes" New topic
Author

How to set actionForm initial values from session attributes

Sam Sunamin
Ranch Hand

Joined: Mar 16, 2007
Posts: 113
Requirements:

I need to populate the initial values from Session attributes using actionForm. Can anyone help me?

For Example, I have a customer whose credit card's number, address, phone number and so on are already stored as session attributes.

Before the customer pay his bill, he may change his credit information. So I used action form to work with action class and the action form should have the initial values from attribute.

Help me, please and thank you in advance.
[ July 18, 2007: Message edited by: Sam Sunamin ]

Yours Sam<br />SCJP5.0 97%<br />SCBCD5.0 72%
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This sounds pretty straightforward to me. Just create an Action class that forwards to the JSP. In that Action class, retrieve the values from the session and put them in the ActionForm. Example:

In the above code, the variable form represents the ActionForm object passed into the execute method as a parameter.
[ July 18, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Sam Sunamin
Ranch Hand

Joined: Mar 16, 2007
Posts: 113
Thank you so much,Merrill.

I got the idea.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set actionForm initial values from session attributes