[EMAIL PROTECTED] schrieb:
In the case you outlined, wizardForm should be placed into the session
scope when leaving the Funds action.
Shouldn't it be in the session scope by specifying
scope="session" in the action tags in the struts-config.xml?
You are not required to use the
struts tags to access the data, but if you are using the struts html
tags for input etc, you will need to use the html:form tag. If you are
not using the struts tags, you should still be able to use the form bean
with a standard <jsp:usebean id="wizardForm" scope="session"> You should
also be able to access it from other action classes by explicitly
calling the getAttribute("wizardForm"). When you say that it is
instantiated with every new page, how are you attempting to access the bean?
I use the bean in several pages. The idea is to have something like
a wizard. On every page a part of data gets added to the wizard bean.
Action.execute() provides a ActionForm parameter. By using this
parameter I access the bean.
What happens is that the bean gets created, filled with the parameters
from the request. In the action class I can access it (and I see
the filled in values on the next page). On the following page a new
formular gets filled. Then the bean gets created again, and filled
with the new parameters. The values from the last page are lost.
Now a possible workaround would be to copy the data from the bean
to some wizard-object which I put in session-scope manually. But
I would like to have a workaround-free solution.
I thought, the supposed behavior is that a bean declared to be within
session-scope lives within the session as long as the session lives.
And if it doesn't exist, it gets created by the struts-framework.
Am I wrong?
I mapped the same bean to several actions in the struts-config.xml:
<form-bean name="wizardForm"
type="com.cp.pub.WizardForm"/>
:
:
<action-mappings>
<action path="/Funds"
type="com.cp.pub.DefineContentFundsAction"
name="wizardForm"
scope="session">
</action>
<action path="/Main"
type="com.cp.pub.DefineContentMainAction"
name="wizardForm"
scope="session">
</action>
<action path="/Datail"
type="com.cp.pub.DefineContentDatailAction"
name="wizardForm"
scope="session">
</action>
:
:
Martin Morawetz <[EMAIL PROTECTED]>
Martin Morawetz <[EMAIL PROTECTED]>
07/19/2005 07:12 AM
Please respond to
"Struts Users Mailing List" <user@struts.apache.org>
To
Struts Users Mailing List <user@struts.apache.org>
cc
Subject
Re: instantiation of actionforms in session scope
Thanks a lot for your answer.
> There could be several poteintal problems.
>
> 1) make sure the JSP does not have the session=false page directive set.
It doesn't.
> 2) Make sure you are referencing the form using the same name as you
> have it defined in the struts config (remember capitalization does
count).
I've checked that and than again, the right bean gets filled with the
right parameters from the request, so I think the problem isn't the
configuration. The problem arises on the following pages, where I need
the data to, but the bean gets instantiated with every new page again.
The following lines are from my struts-config.xml:
<form-bean name="wizardForm"
type="com.cp.pub.WizardForm"/>
:
:
<action-mappings>
<action path="/Funds"
type="com.cp.pub.DefineContentFundsAction"
name="wizardForm"
scope="session">
</action>
:
:
> 3) Make sure you are accessing the form from within the html:form tag
> and that the struts action specified in the form action has the expected
> form as the type in the struts config.
>
I don't use html:form-tags. Could that be a problem?
>
>
>
>
> Hi to all,
>
> I use a formbean within session-scope (declared in
> struts-config.xml). However it behaves like it would
> be within request-scope. Every new page it gets
> instantiated again. I checked the sessionid and
> it is every page the same, so I guess am within the
> same http-session.
>
> Does anyone have some ideas what the reason may be?
>
> Every hint is highly appreciated.
>
--
Regards
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]