You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "C.F. Scheidecker Antunes" <na...@antunes.eti.br> on 2005/08/16 05:18:32 UTC
getting a Form from the Session Scope from another Action
Hello all,
Say that I have the following situation:
<action path="/step1" name="Step1Form" scope="session"
type="org.apache.struts.actions.ForwardAction"
parameter = "step1page.jsp"/>
<action path="ProcessStep1" name="Step1Form" scope="session"
type="com.meu.Dispatch"
parameter = "methodToCall"/>
<forward name ="next" path="/step2.do">
</action>
<action path="/step2" name="Step2Form" scope="request"
type="com.meu.Dispatch"
parameter = "methodToCall"/>
<forward name ="previous" path="/step1.do">
<forward name ="next" path="/step3.do">
</action>
Ok, the first action calls a jsp that, when submited, calls ProcessStep1
action and populates the Step1Form. However on step2 I am doing a file
upload so I am declaring the form, which is not Step1Form, to be of
request scope not session scope. Hence everytime the values of that form
are reset. However, within step2 Action I would like to retrieve
Step1Form as well so that I can work with values from both form:
Step1Form which is session scope and Step1Form which is request Scope.
So my big question is: How can I retrieve from session scope Step1Form
within the step2 Action?
Step2Form can be easily retrieved inside step2 action by:
Step2Form form2 = (Step2Form) form;
How can I retrieve Step1From in this action (step2) as well?
The execute function passes just one ActionForm form which I am using
for the Step2Form as specified on the struts-config.xml.
So can I, somehow, access Step1Form from the session scope?
Thanks,
C.F.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: getting a Form from the Session Scope from another Action
Posted by Yuniar Setiawan <yu...@gmail.com>.
it would be like this:
Step1Form form1 = (Step1Form) request.getSession
().getAttribute("Step1Form");
On 8/16/05, C.F. Scheidecker Antunes <na...@antunes.eti.br> wrote:
>
> Hello all,
>
> Say that I have the following situation:
>
> <action path="/step1" name="Step1Form" scope="session"
> type="org.apache.struts.actions.ForwardAction"
> parameter = "step1page.jsp"/>
>
> <action path="ProcessStep1" name="Step1Form" scope="session"
> type="com.meu.Dispatch"
> parameter = "methodToCall"/>
> <forward name ="next" path="/step2.do">
> </action>
>
> <action path="/step2" name="Step2Form" scope="request"
> type="com.meu.Dispatch"
> parameter = "methodToCall"/>
> <forward name ="previous" path="/step1.do">
> <forward name ="next" path="/step3.do">
> </action>
>
> Ok, the first action calls a jsp that, when submited, calls ProcessStep1
> action and populates the Step1Form. However on step2 I am doing a file
> upload so I am declaring the form, which is not Step1Form, to be of
> request scope not session scope. Hence everytime the values of that form
> are reset. However, within step2 Action I would like to retrieve
> Step1Form as well so that I can work with values from both form:
> Step1Form which is session scope and Step1Form which is request Scope.
>
> So my big question is: How can I retrieve from session scope Step1Form
> within the step2 Action?
> Step2Form can be easily retrieved inside step2 action by:
> Step2Form form2 = (Step2Form) form;
>
> How can I retrieve Step1From in this action (step2) as well?
> The execute function passes just one ActionForm form which I am using
> for the Step2Form as specified on the struts-config.xml.
>
> So can I, somehow, access Step1Form from the session scope?
>
> Thanks,
>
> C.F.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>