On Wed, 6 Jun 2001, Jonathan wrote:

> I for one dont even understand the value in the "input value" parameter.
> There could be MANY pages that got you to the page you are on.  The "input"
> value just makes one possible origin available for you to have as a return
> target should things go fowl.  I had been saying on this discussion that
> there should be more or less 4 different destinations:

The "input" parameter defines where the Struts controller servlet will
forward control to if your form bean's validate() method returns errors.

> 1) where you came from (referrer, or if there is no referrer a default
> page...see below)
> 2) where you were originally going when you were interrupted
> 3) a specific page - (can be success or failure page or could be the first
> page in a form)
> 4) a default page
> 

One thing to note is that "where you came from" is not particularly
obvious.  If every request goes through the controller servlet (the usual
case in an MVC-based application), then the "referer" value will be the
name of an action (i.e. an xxx.do if you use the default naming approach),
not the name of a page.

Craig


> 
> ----- Original Message -----
> From: "David Noll" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 06, 2001 1:24 PM
> Subject: RE: input in XML config
> 
> 
> >
> > Forget what I said last night about calling setInput() from the
> > ActionForm. Setting the input in the ActionForm's validate method
> > flagrantly violates Struts' MVC architecture; flow of control should
> > always be defined by the controller servlet and struts-config.xml. But
> > saving request scope variables as part of an ActionForm isn't always
> > an option. I think the best solution to Max's problem is to define the
> > input as the full path to the original action, then make sure that the
> > form coming from that page includes the necessary parameters to
> > recreate the original action page.
> >
> > The following hypothetical situation should make this a bit clearer:
> >
> > - You are running an online bookstore backed by a database. To display
> >   books you have defined an action as "viewbook.do". The action takes
> >   one parameter, an ISBN, so the user ends up seeing the url
> >   http://server/viewbook.do?ISBN=123.
> >
> > - On the book's page, you have a form asking users to rate the
> >   book. Part of the rating form uses a select box generated from a
> >   database of possible ratings (this list, all the possible ratings,
> >   is the kind of request scope variable that one would *not* want to
> >   store as part of a form; the list doesn't pertain to data the user
> >   entered, it merely defines *possible* input values).
> >
> > - When the user submits the ratings form, an ActionForm validates the
> >   input. In struts-config, the input attribute for the "save ratings"
> >   action is defined as "viewbook.do". Now suppose that the ratings
> >   ActionForm generates errors... in order for the "view book" action
> >   to successfully recreate the page that the ratings form was
> >   submitted from, it needs an ISBN parameter. The solution to that
> >   seems fairly simple--just drop in a hidden ISBN field in the ratings
> >   form.
> >
> > What I don't like about this solution is that information essential to
> > successfully defining the flow of control--a parameter that is part of
> > the definition of the input page--has to be in an HTML form. Perhaps a
> > feature for Struts 1.1 could be a special input value that signified
> > "use the form's HTTP referrer header, including all request
> > parameters, as the input for this form". Or, quite possibly, there is
> > an even more elegant solution that someone out there has discovered.
> >
> > Cheers,
> > David
> >
> > -----Original Message-----
> > From: Ted Husted [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, June 05, 2001 9:11 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: input in XML config
> >
> >
> > Could you create these request scope beans as properties of the
> > ActionForm?
> >
> > David Noll wrote:
> > >
> > > Max,
> > >
> > > I don't know if it's the official way to do it, but in my ActionForm's
> > > validate() method, I call mapping.setInput() with the full path of the
> > > original Action. An important thing to note is that if your Action class
> > > pre-populates an ActionForm for the page, you should check for the
> > > ActionForm's existence before populating it.
> > >
> > > All that said, it does seem a bit cumbersome to go through all that
> merely
> > > to return to a dynamically generated input page if there are form
> errors.
> > > Does anyone on the list know of a cleaner way to achieve this?
> > >
> > > David
> > >
> > > --
> > > David Noll, Public Digital
> > > [EMAIL PROTECTED]
> > >
> > > -----Original Message-----
> > > From: LORENA MASSIMO [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, June 05, 2001 6:37 AM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: input in XML config
> > >
> > > Hi,
> > > in an action mapping i'd like to reexecute the complete action instead
> of
> > a
> > > simple jsp when the validate method of the form fails, because i need to
> > > create some beans having request scope
> > > So my question is...
> > > Is it possible to have an action in the input fiele of a mapping instead
> > of
> > > a simple jsp?
> > > thanks Max
> >
> 
> 

Reply via email to