You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Linus Nikander <li...@nikander.net> on 2003/09/24 10:41:34 UTC
Ensuring a clean Form
How do I ensure that each invocation of a particular action receives a
"clean" form. I.e a form where no values from any previous invocation are
present.
I remember reading somewhere that under certain conditions "old" values from
one invocation could, because struts reuses form instances, be present in a
later invocation.
Is this true or have i misunderstood something ? I also remember reading
something about a reset() method for the ActionForm. Is this the method one
should use to reset all values ? When exactly is the reset() method called
in that case ?
//Linus Nikander linus @nikander.net
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Ensuring a clean Form
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Exactly.
On 09/24/2003 11:23 AM Linus Nikander wrote:
> Ok, that clears a few things up. As far as session-scope is concerned. Do I
> understand it correctly that two separate user-sessions will NEVER share a
> populated form-instance ? I.e the only time this problem may occur is when a
> single user, within the same session where form persistence is defined to
> session scope, calls the same form twice ?
>
> //Linus
>
> "Adam Hardy" <ah...@cyberspaceroad.com> wrote in message
> news:3F715E16.70205@cyberspaceroad.com...
>
>>Hi Linus,
>>declare your forms in request scope for your mappings, then they will
>>only ever be populated by your request parameters.
>>
>>In session scope, a form bean is reused but before initialisation,
>>reset() is called at which point you can clean down the member variables.
>>
>>Adam
>>
>>On 09/24/2003 10:41 AM Linus Nikander wrote:
>>
>>>How do I ensure that each invocation of a particular action receives a
>>>"clean" form. I.e a form where no values from any previous invocation
>
> are
>
>>>present.
>>>
>>>I remember reading somewhere that under certain conditions "old" values
>
> from
>
>>>one invocation could, because struts reuses form instances, be present
>
> in a
>
>>>later invocation.
>>>
>>>Is this true or have i misunderstood something ? I also remember reading
>>>something about a reset() method for the ActionForm. Is this the method
>
> one
>
>>>should use to reset all values ? When exactly is the reset() method
>
> called
>
>>>in that case ?
>>>
>>>//Linus Nikander linus @nikander.net
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>
>>--
>>struts 1.1 + tomcat 4.1.27 + java 1.4.2
>>Linux 2.4.20 RH9
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Ensuring a clean Form
Posted by Linus Nikander <li...@nikander.net>.
Ok, that clears a few things up. As far as session-scope is concerned. Do I
understand it correctly that two separate user-sessions will NEVER share a
populated form-instance ? I.e the only time this problem may occur is when a
single user, within the same session where form persistence is defined to
session scope, calls the same form twice ?
//Linus
"Adam Hardy" <ah...@cyberspaceroad.com> wrote in message
news:3F715E16.70205@cyberspaceroad.com...
> Hi Linus,
> declare your forms in request scope for your mappings, then they will
> only ever be populated by your request parameters.
>
> In session scope, a form bean is reused but before initialisation,
> reset() is called at which point you can clean down the member variables.
>
> Adam
>
> On 09/24/2003 10:41 AM Linus Nikander wrote:
> > How do I ensure that each invocation of a particular action receives a
> > "clean" form. I.e a form where no values from any previous invocation
are
> > present.
> >
> > I remember reading somewhere that under certain conditions "old" values
from
> > one invocation could, because struts reuses form instances, be present
in a
> > later invocation.
> >
> > Is this true or have i misunderstood something ? I also remember reading
> > something about a reset() method for the ActionForm. Is this the method
one
> > should use to reset all values ? When exactly is the reset() method
called
> > in that case ?
> >
> > //Linus Nikander linus @nikander.net
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
> --
> struts 1.1 + tomcat 4.1.27 + java 1.4.2
> Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Ensuring a clean Form
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Linus,
declare your forms in request scope for your mappings, then they will
only ever be populated by your request parameters.
In session scope, a form bean is reused but before initialisation,
reset() is called at which point you can clean down the member variables.
Adam
On 09/24/2003 10:41 AM Linus Nikander wrote:
> How do I ensure that each invocation of a particular action receives a
> "clean" form. I.e a form where no values from any previous invocation are
> present.
>
> I remember reading somewhere that under certain conditions "old" values from
> one invocation could, because struts reuses form instances, be present in a
> later invocation.
>
> Is this true or have i misunderstood something ? I also remember reading
> something about a reset() method for the ActionForm. Is this the method one
> should use to reset all values ? When exactly is the reset() method called
> in that case ?
>
> //Linus Nikander linus @nikander.net
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: Ensuring a clean Form
Posted by Mohd Amin Mohd Din <am...@nc.com.my>.
Yes.
-----Original Message-----
From: Linus Nikander [mailto:linus@nikander.net]
Sent: Wednesday, September 24, 2003 4:42 PM
To: struts-user@jakarta.apache.org
Subject: Ensuring a clean Form
How do I ensure that each invocation of a particular action receives a
"clean" form. I.e a form where no values from any previous invocation
are
present.
I remember reading somewhere that under certain conditions "old" values
from
one invocation could, because struts reuses form instances, be present
in a
later invocation.
Is this true or have i misunderstood something ? I also remember reading
something about a reset() method for the ActionForm. Is this the method
one
should use to reset all values ? When exactly is the reset() method
called
in that case ?
//Linus Nikander linus @nikander.net
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org