You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Xavier Brunel <xa...@profileup.com> on 2001/09/04 12:06:20 UTC

One ActionForm One Action for Multiple different JSP

hi all,

I have a software design problem with Struts.

I have to deal with an application where you fill a global form across
several jsp's :
I have to fill some fields in the first JSP, then press next, fill other
fields, press next(or back), fill other fields, ... In each JSP, i can
submit the form.

I decide to Build one big ActionForm, containing all the possible fields of
all JSPs, and one big Action class where you find all the action possible on
these JSPs.
I then modify the struts-config.xml file and make several <action> tags,
mapping this same ActionForm and this same Action but forwarding to
different JSP in order to deal with the navigation.

My problem is that when I move from one JSP to another through the "next" or
"back" buttons or submit the form in the current page, I lost the previous
containt of my ActionForm. It seems that I get a new instance of my
ActionForm as soon as i navigate in my application.

I think it's a software design problem, not an implementation one though it
is working pretty well elsewhere.
Has anybody an idea of the way to solve this,
or an explanation on how to organize a Struts application to deal with
multiple JSP for one ActionForm and one Action ???

Xavier


CDATA with Digester

Posted by Bernard Genin <be...@nrb.be>.
Hello List,

Is it normal to get an exception when one tries to parse CDATA tags  with
Digester ? (maybe related to Sax)
Like in :
..
<sometag>
some text <![CDATA[<some HTML tag> ...</some HTML tag>]]>
</sometag>

Thanks for any hint,

.B


Re: One ActionForm One Action for Multiple different JSP

Posted by Ted Husted <hu...@apache.org>.
On each request, Struts will call reset() and try to repopulate the bean
from the current request. The default reset() does nothing.

You need to be sure that your reset() method does not clear all the
fields when you are using it to collect properties this way. One
strategy is to set a flag, like "populated", on the first page, and then
use that to decide whether to actually reset the properties or not. 

One reason Struts need to call reset() is due to the way HTML/HTTP
handles things like checkboxes, which may be omitted from a request if
they are unset. The reset() gives you a chance to handle these properly,
but then confounds other things, like wizard forms ;-( 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/


Xavier Brunel wrote:
> 
> hi all,
> 
> I have a software design problem with Struts.
> 
> I have to deal with an application where you fill a global form across
> several jsp's :
> I have to fill some fields in the first JSP, then press next, fill other
> fields, press next(or back), fill other fields, ... In each JSP, i can
> submit the form.
> 
> I decide to Build one big ActionForm, containing all the possible fields of
> all JSPs, and one big Action class where you find all the action possible on
> these JSPs.
> I then modify the struts-config.xml file and make several <action> tags,
> mapping this same ActionForm and this same Action but forwarding to
> different JSP in order to deal with the navigation.
> 
> My problem is that when I move from one JSP to another through the "next" or
> "back" buttons or submit the form in the current page, I lost the previous
> containt of my ActionForm. It seems that I get a new instance of my
> ActionForm as soon as i navigate in my application.
> 
> I think it's a software design problem, not an implementation one though it
> is working pretty well elsewhere.
> Has anybody an idea of the way to solve this,
> or an explanation on how to organize a Struts application to deal with
> multiple JSP for one ActionForm and one Action ???
> 
> Xavier