You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sonam Belbase <So...@morganstanley.com> on 2003/10/27 20:04:31 UTC
question about reset()
I'm trying to understand ActionForms a bit better and here is my
question:
If the servlet controller automatically invokes the reset() method
before passing the ActionForm bean to the Action implementation class
instance, how can you use the form's properties' values in your action?
Is this why in the action, you need to downcast the form argument passed
by the controller servlet to your Actionform as such:
String userName = ((LoginForm) form).getUserName();
Thanks,
SB
--
NOTICE: If received in error, please destroy and notify sender. Sender
does not waive confidentiality or privilege, and use is prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: question about reset()
Posted by Manish Singla <Ma...@Sun.COM>.
may be check out the scope....(session/request)...
Your FormBean should be stored in same scope as mentioned in
struts-config.xml...
Sonam Belbase wrote:
> OK thanks Brice and Manish,
>
> I was not able to retrieve the values of my form properties in my action and
> according to your explanations, I can rule out reset() as the source of the
> problem.
>
> Thanks.
>
> SB
>
> Manish Singla wrote:
>
>
>>Please see below ..
>>Sonam Belbase wrote:
>>
>>>I'm trying to understand ActionForms a bit better and here is my
>>>question:
>>>
>>>If the servlet controller automatically invokes the reset() method
>>>before passing the ActionForm bean to the Action implementation class
>>>instance, how can you use the form's properties' values in your action?
>>>
>>
>>After reset() is invoked, struts populate the ActionForm Bean .
>>FYI: Struts populate ActionForm Bean with all request params
>>(post/get/...) using reflection.
>>
>>
>>>Is this why in the action, you need to downcast the form argument passed
>>>by the controller servlet to your Actionform as such:
>>>
>>>String userName = ((LoginForm) form).getUserName();
>>>
>>
>>We downcast in Action because in Action we receive base class "ActionForm".
>>
>>
>>>Thanks,
>>>SB
>>
>>Manish Singla
>>
>>
>>>--
>>>NOTICE: If received in error, please destroy and notify sender. Sender
>>>does not waive confidentiality or privilege, and use is prohibited.
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>
>>--
>>Thanks
>>Manish Singla
>>x73166
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> --
> NOTICE: If received in error, please destroy and notify sender. Sender does
> not waive confidentiality or privilege, and use is prohibited.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
--
Thanks
Manish Singla
x73166
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: question about reset()
Posted by Sonam Belbase <So...@morganstanley.com>.
OK thanks Brice and Manish,
I was not able to retrieve the values of my form properties in my action and
according to your explanations, I can rule out reset() as the source of the
problem.
Thanks.
SB
Manish Singla wrote:
> Please see below ..
> Sonam Belbase wrote:
> > I'm trying to understand ActionForms a bit better and here is my
> > question:
> >
> > If the servlet controller automatically invokes the reset() method
> > before passing the ActionForm bean to the Action implementation class
> > instance, how can you use the form's properties' values in your action?
> >
>
> After reset() is invoked, struts populate the ActionForm Bean .
> FYI: Struts populate ActionForm Bean with all request params
> (post/get/...) using reflection.
>
> > Is this why in the action, you need to downcast the form argument passed
> > by the controller servlet to your Actionform as such:
> >
> > String userName = ((LoginForm) form).getUserName();
> >
> We downcast in Action because in Action we receive base class "ActionForm".
>
> >
> > Thanks,
> > SB
>
> Manish Singla
>
> >
> > --
> > NOTICE: If received in error, please destroy and notify sender. Sender
> > does not waive confidentiality or privilege, and use is prohibited.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
> --
> Thanks
> Manish Singla
> x73166
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
--
NOTICE: If received in error, please destroy and notify sender. Sender does
not waive confidentiality or privilege, and use is prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: question about reset()
Posted by Manish Singla <Ma...@Sun.COM>.
Please see below ..
Sonam Belbase wrote:
> I'm trying to understand ActionForms a bit better and here is my
> question:
>
> If the servlet controller automatically invokes the reset() method
> before passing the ActionForm bean to the Action implementation class
> instance, how can you use the form's properties' values in your action?
>
After reset() is invoked, struts populate the ActionForm Bean .
FYI: Struts populate ActionForm Bean with all request params
(post/get/...) using reflection.
> Is this why in the action, you need to downcast the form argument passed
> by the controller servlet to your Actionform as such:
>
> String userName = ((LoginForm) form).getUserName();
>
We downcast in Action because in Action we receive base class "ActionForm".
>
> Thanks,
> SB
Manish Singla
>
> --
> NOTICE: If received in error, please destroy and notify sender. Sender
> does not waive confidentiality or privilege, and use is prohibited.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
--
Thanks
Manish Singla
x73166
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: question about reset()
Posted by "Ruth, Brice" <br...@fiskars.com>.
to my knowledge, reset() is called to clear the form (and perform any
re-initialization), before calling the setters for the form parameters
being submitted by the browser.
this way, the action that accesses the actionform will always have the
values submitted by the browser, no more, no less - instead of possibly
having "stale" data. the subclassing is done because ActionForm is being
extended by each of your classes, and ActionForm doesn't have javabean
methods for all the parameters in your form - your ActionForm class has
those.
Sonam Belbase wrote:
>I'm trying to understand ActionForms a bit better and here is my
>question:
>
>If the servlet controller automatically invokes the reset() method
>before passing the ActionForm bean to the Action implementation class
>instance, how can you use the form's properties' values in your action?
>
>Is this why in the action, you need to downcast the form argument passed
>by the controller servlet to your Actionform as such:
>
>String userName = ((LoginForm) form).getUserName();
>
>
>Thanks,
>SB
>
>--
>NOTICE: If received in error, please destroy and notify sender. Sender
>does not waive confidentiality or privilege, and use is prohibited.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org