struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Stace <s45652...@yahoo.com>
Subject Re: Are Vectors in a FormAction set to null after a user has submitted a form?
Date Fri, 01 Feb 2002 09:42:45 GMT
Ok...I think I know what is going on, but can someone please tell me if this is
correct or not.  
Action1 sets up the ActionForm and sets a number of variables in it, including the Vectors
which are
used to generate the drop down list boxes.
The form is displayed to the user with the values which were populated in the form.
The user submits the form,  a new ActionForm is created and the variables in the fields the
user filled in on the form they submitted are set in the new ActionForm.  The values in this
new ActionForm
are then passed to the processing Action?  The Vectors I populated in Action1 are not set
in the new ActionForm
because since the user does not set them in the form they submit.

Does this sound correct?

Cheers

Tony

On Fri, 1 Feb 2002 16:46:14 +0900
Antony Stace <s45652001@yahoo.com> wrote:

> Thanks for the reply Chuck.
> 
> The action I am calling is the first action after the form has been filled in and the
user submits the form.  All
> the data should still be in the form.  I can access all the other variables in this ActionForm
which are of type String, so
> I find it strange that the Vectors have become null.  
> Any ideas? 
> 
> 
> Cheers
> 
> Tony
> 
> On Fri, 01 Feb 2002 02:37:38 -0500
> Chuck Cavaness <struts-user@japache.org> wrote:
> 
> > Just guessing, but the reason the Vectors are null is probably because the action
that is being called is configured as request scope and not session in the Struts configuration
file. Therefore, after the HTML page is drawn (using the Vectors to populate the drop-down
boxes), the ActionForm is recycled because the request is complete. If you need data like
this to stick around and not have to get it again from your database or backend, then you
either going to have to make the action session scope, or hide the data in the page. Take
a look at the ActionMapping defined for the action being called and see if it doesn't have
something like scope="request". Actually, I think the default is request, so if you don't
have a line scope="request" in the mapping, it will default to request scope.
> > 
> > You might try making this scope="session". Check out the JavaDoc on the ActionMapping
class for more information.
> > 
> > Chuck
> > 
> > p.s. Is anyone really using the Vector class anymore? Why aren't you using List/ArrayList?
Just curious.
> > --
> > Sent via jApache.org
> > 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message