It's not a secret anymore!
The moose likes Struts and the fly likes ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionForm" Watch "ActionForm" New topic


Kalyani Nayak

Joined: Jan 01, 2006
Posts: 25
I am studing struts. While reading from one of the site, link below
I am little bit confused with the point, in the explaination for the 'Form-beans' as follows-

<pre>name: Must have a unique bean name. This name is used as reference in the action mappings.
<b>Often, this is also the name of the request or the session attribute under which the form is stored.</b>

But in case if I want to set two different references of the form beans in the request and session scope then
what will the aproach.

one of the property of form bean, I want to skip from the session scope reference.
Frank Bueckert

Joined: Mar 23, 2006
Posts: 8
form beans can be either request or session scope.

In your controller class, do your calculations, and then put
for request objects
for session objects.

Then, in your JSP, you put

Just make sure you have scope set to the instance you want, and you'll have access to it. Just point all struts name parameters at the bean:define id parm, and you can yank whatever you want out of it.

There's probably an easier way to do this, but that's how I do it.
[ March 24, 2006: Message edited by: Frank Bueckert ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Trying to keep a copy of the ActionForm bean in both the request and the session at the same time would be a very bad idea. Struts would read one or the other (I'm not really sure which) but not both. I'm not sure what you're trying to accomplish by doing this, but I suggest finding another way to accomplish the same thing.

Consultant, Sima Solutions
I agree. Here's the link:
subject: ActionForm
jQuery in Action, 3rd edition