You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaskar Gopalan <bg...@adaptintel.com> on 2002/03/28 00:07:11 UTC
Accessing action object inside the form bean
Hi,
I open a form, collect user input and on submit store it in the action class
(inside perform()) as
instance variables. Next time when the same form is opened, I want to
retrieve the values
stored in the action class. Since a new instance of the form bean is created
every time a form
is accessed, is there anyway to get the field values stored in the action
class from the bean
form?
Thanks,
Bhaskar
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Accessing action object inside the form bean
Posted by Nicolas De Loof <ni...@cgey.com>.
Be carreful, your action class must be threadsafe, so you cannot store datas
as intance variable. Use session scope instead.
> Hi,
>
> I open a form, collect user input and on submit store it in the action
class
> (inside perform()) as
> instance variables. Next time when the same form is opened, I want to
> retrieve the values
> stored in the action class. Since a new instance of the form bean is
created
> every time a form
> is accessed, is there anyway to get the field values stored in the action
> class from the bean
> form?
>
> Thanks,
> Bhaskar
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Accessing action object inside the form bean
Posted by Javier Campoamor <jc...@lapize.com>.
You can also use a promptAction, to populate the form with the values that
you want, before putting it into the request. Some thing lije this:
PromptAction(Populates the form with default values)->ActionForm(Gets the
user input)->DoAction(Process the form)
Regards
> -----Mensaje original-----
> De: srinivas [mailto:sv@intensit.de]
> Enviado el: jueves 28 de marzo de 2002 0:23
> Para: Struts Users Mailing List
> Asunto: RE: Accessing action object inside the form bean
>
>
> hello,
>
> set the scope in the struts-config.xml for the action to have session.
> <action path="<name of action>"
> type="<fully qualified class name>"
> scope="session"
> name="<name of form>"
> >
> </action>
> then set the fields u want to save across requests in the form bean.
> in this case new instance will not be created.
>
> hope this helps.
>
> regards,
> srinivas
> -----Original Message-----
> From: Bhaskar Gopalan [mailto:bgopalan@adaptintel.com]
> Sent: Thursday, March 28, 2002 1:07 AM
> To: Struts Group (E-mail)
> Subject: Accessing action object inside the form bean
>
>
> Hi,
>
> I open a form, collect user input and on submit store it in the
> action class
> (inside perform()) as
> instance variables. Next time when the same form is opened, I want to
> retrieve the values
> stored in the action class. Since a new instance of the form bean
> is created
> every time a form
> is accessed, is there anyway to get the field values stored in the action
> class from the bean
> form?
>
> Thanks,
> Bhaskar
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Accessing action object inside the form bean
Posted by srinivas <sv...@intensit.de>.
hello,
set the scope in the struts-config.xml for the action to have session.
<action path="<name of action>"
type="<fully qualified class name>"
scope="session"
name="<name of form>"
>
</action>
then set the fields u want to save across requests in the form bean.
in this case new instance will not be created.
hope this helps.
regards,
srinivas
-----Original Message-----
From: Bhaskar Gopalan [mailto:bgopalan@adaptintel.com]
Sent: Thursday, March 28, 2002 1:07 AM
To: Struts Group (E-mail)
Subject: Accessing action object inside the form bean
Hi,
I open a form, collect user input and on submit store it in the action class
(inside perform()) as
instance variables. Next time when the same form is opened, I want to
retrieve the values
stored in the action class. Since a new instance of the form bean is created
every time a form
is accessed, is there anyway to get the field values stored in the action
class from the bean
form?
Thanks,
Bhaskar
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>