struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Livingston <>
Subject RE: Are Vectors in a FormAction set to null after a user has subm itted a form?
Date Fri, 01 Feb 2002 16:25:44 GMT
I can't comment on the scope issue; but, I have had similar problems.

Think about what is going on. HTML cannot deal with collection and arrays,
right. That's why we iterate through them and make our static html page.
When the HTML form comes back to the server, the vectors are null because
they simply do not exist in the HTML form.

I suppose setting scope to session could work, but it is an inelegant
solution,to me ;)

What I have done to get around such problems is bounce to an action to
refill the Collections and then send on to another action. This works well
if you just need a simple database query.

Another method would be to use javascript to flatten the arrays to a long
string and place in a hidden filed upon submission. And then in you action,
tokenize through the flattened string, create your Vector, and pop back into
the form.


> -----Original Message-----
> From: Antony Stace []
> Sent: Friday, February 01, 2002 10:25 AM
> To: Struts Users Mailing List
> Subject: Re: Are Vectors in a FormAction set to null after a user has
> submitted a form?
> Hi Chuck
> I just tried having the first actions scope set to scope="session" and the
> second actions scope set to scope="session"
> and still the Vector data is still disapearing.  I actually, for a test,
> set another field in ActionForm in the first action to a
> test value, I didn't have this set on the form anywhere where the user
> could change this value, then in the
> second action I tried to access this data, but it was not there - it too
> was gone.  Somehow a new form is being created
> and the scope="session" is not happening.
> Any ideas anyone?
> Cheers
> Tony
> On Fri, 01 Feb 2002 07:51:12 -0500
> Chuck Cavaness <> wrote:
> > That's sort of what I was saying. In the second action, the one that is
> called after the user sees the form data and makes some choices, does the
> scope equal to request or session? If you have both of these actions
> defined as session scope, then I don't believe a new ActionForm would be
> created during the second action. If the mapping is session, then an
> ActionForm will be looked for in the session, which should have been put
> there on the previous action (along with the Vector data in it still).
> >
> > However, if the second action is defined as request and the first one is
> session, then yes the user entered data would make it to the new
> ActionForm and the Vector data would be gone because one would be
> recycled.
> >
> > Obviously, this is all a guess. I hope it helps somehow.
> >
> > Chuck
> > --
> > Sent via
> >
> > --
> > To unsubscribe, e-mail:   <mailto:struts-user-
> > For additional commands, e-mail: <mailto:struts-user-
> --
> Cheers
> Tony。
> ---------------------------------------------------------------------
> _________________________________________________________
> Do You Yahoo!?
> Get your free address at
> --
> To unsubscribe, e-mail:   <mailto:struts-user-
> For additional commands, e-mail: <mailto:struts-user-

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message