On Thu, 2 Aug 2001, John Yu wrote:
> Martin,
>
> Oh, I see. That's what the "parameter" attribute is for! Thanks.
Well, that is what the "parameter" value is used for in this case, at
least :-). In practice, the "parameter" attribute is a way to pass a
single string configuration value into an Action, and means whatever your
action interprets it to mean. This covers the common case of needing to
be able to pass some special parameter from struts-config.xml to an
action, without having to mess around with subclassing ActionMapping.
> --
> John
>
Craig
>
> At 10:26 AM 8/1/2001 -0700, you wrote:
> >This mechanism is already available in Struts. Take a look at the
> >DispatchAction class:
> >
> >http://jakarta.apache.org/struts/api/org/apache/struts/actions/DispatchActio
> >n.html
> >
> >--
> >Martin Cooper
> >
> >
> >----- Original Message -----
> >From: "John Yu" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Wednesday, August 01, 2001 1:48 AM
> >Subject: Re: AW: AW: action-mapping: why must the action-Attribute path be
> >equivalent to the name of the jsp?
> >
> >
> > > I share a similar concern.
> > >
> > > I'm wondering if it makes sense to extend Struts' mapping architecture
> > > so that it will also look into a 'magic' url parameter and dispatch
> > > accordingly.
> > >
> > > For example, if the URL is
> > >
> > >
> > >
> > > MyAction.do?subAction=Create
> > >
> > >
> > >
> > >
> > > the ActionServlet will dispatch the request to the MyActionCreate class
> > > given the following (enhanced) action mapping.
> > >
> > > <action path="MyAction" subAction="Create" type="MyActionCreate" .../>
> > >
> > > This will make it easily to have forms with multiple buttons which
> > > require different actions.
> > > --
> > > John
> > >
> > >
> > > At 10:18 AM 8/1/2001 +0200, you wrote:
> > >
> > >
> > > Isn't it against the mvc philosophy to put navigation code (e.g.
> > > control)
> > > into
> > > a tag (e.g. view) ?
> > >
> > > -----Ursprungliche Nachricht-----
> > > Von: Ted Husted [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ]
> > > Gesendet: Dienstag, 31. Juli 2001 18:42
> > > An: [EMAIL PROTECTED]
> > > Betreff: Re: AW: action-mapping: why must the action-Attribute path be
> > > equivalent to the name of the jsp?
> > >
> > >
> > > The usual solution would be to design your forms to contain hidden
> > > fields that tell the Action which operation to perform with the next
> > > request. So typically, there would be one button with a hidden field
> > > that conveyed whether this was the "FirstAction" or the "SecondAction".
> > > These would all go back to a single Action that either performed all the
> > > operations, or forwarded onto another Action.
> > >
> > > If you will be using this button that much, you might also consider
> > > writing your own custom tag so the button could program itself from the
> > > request. In general, the request is meant to convey information to the
> > > presentation layer about how it is suppose to write itself.
> > >
> > > In my own projects, I am experimenting with ways to make the current
> > > ActionMappings available to the JSP, as they are to perform() and
> > > validate(), which starts to open several doors.
> > >
> > >
> > > [EMAIL PROTECTED] wrote:
> > > >
> > > > Thanks, at least it's a working work-around. But the ugly thing is,
> > > that
> > > in
> > > > both cases the same action is called and I am forced to call the
> > > "real"
> > > > action
> > > > from the first action depending on the pushed button.
> > > >
> > > > + Action inserts "fire" bean into rquest context
> > > > + Forward to JSP
> > > > + JSP checks to see if fire==first. If so, write TheFirstAction button
> > > > + JSP checks to see if fire==second. If so, write TheSecondActon
> > > button
> > > > + submit "fires" action
> > > > + action does nothing and forwards to the "real" action depending on
> > > the
> > > > button.
> > > >
> > > > In my real world the page will be reused at least 5 or six times. So
> > > rather
> > > > than
> > > > putting the "Control" part of MVC in the struts-config.xml I start
> > > > piggypacking info
> > > > in the request and analysing this in the dummy action.
> > > >
> > > > However again thanks.
> > > > Peter
> > >
> > > --
> > > John Yu Scioworks Technologies
> > > e: [EMAIL PROTECTED] w: +(65) 873 5989
> > > w: <http://www.scioworks.com /> http://www.scioworks.com
> > > <http://www.scioworks.com /> m: +(65) 9782 9610
> > >
> > >
>
> --
> John Yu Scioworks Technologies
> e: [EMAIL PROTECTED] w: +(65) 873 5989
> w: http://www.scioworks.com m: +(65) 9782 9610