You can use the <forward> in struts-config.xml as a base value and append your 
parameters dynamically. Something like this:

    ActionForward fwd = mapping.findForward("blue");
    StringBuffer path = new StringBuffer(fwd.getPath());
    path.append("?tableID=")
        .append(tableID); // where this might have the value "foo"
    return new ForwardingActionForward(path.toString());

--
Martin Cooper



-----Original Message-----
From:    David Corbin [EMAIL PROTECTED]
Sent:    Sun, 26 Aug 2001 21:07:03 -0400
To:      [EMAIL PROTECTED]
Subject: Re: Dynamic forwardings...


I'm not sure where I'm miscommunication, so I'll go back to the beginning.

I have an action "list".  It expects an parameter "tableID", so a link to it
looks like "http://host/app/list.do?tableID=foo";, and if things are
successful, returns a page with a list of items that depend on the tableID.
For each item, there is a link generated for action "blue" that specifies
two parameters: tableID & itemID
(http://host/app/blue.do?tableID=foo&itemID=xyzzy).

No problem.

The action "blue" requires the two parameters "tableID" and "itemID".  Under
certain circumstances, the results of the action blue require that
"list.do?tableID=foo" be "forwarded".  Struts doesn't seem to provide a way
to handle this last case.  If it does, I don't understand it.

David
----- Original Message -----
From: "Ted Husted" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 26, 2001 7:14 PM
Subject: Re: Dynamic forwardings...


> Typically, there would be a finite number of inputs, and you could have
> a logical forward for each one.
>
> The ActionMappings form an API for the legal entry points to the
> application.
>
> Usually, the only thing that is truly dynamic is a reference into a data
> source, to look something up. In that case, the link tag can take one or
> more dynamic parameters, based on the collection of beans used to write
> it.
>
> In that case, the action usually gets the parameters from the request,
> and uses them to look up whatever is required.
>
> David Corbin wrote:
> >
> > I'm definately talking about "forward", but my "whatever" value is
dynamic.
> > It's based on input (a parameter) into the action.  I don't yet
understand
> > the best solution for that.
> >
> > ----- Original Message -----
> > From: "Ted Husted" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, August 26, 2001 2:56 PM
> > Subject: Re: Dynamic forwardings...
> >
> > > For a forward, you just put in an encoded query string for the path:
> > >
> > >      <forward name="itemAdd"
> > >           path="/do/item/Add?code=whatever"/>
> > >
> > > For an action mapping, you can use the parameter property
> > >
> > >             <action
> > >                 path="/do/item/Add"
> > > ...
> > >                 parameter="add">
> > >             </action>
> > >
> > > and have the action check for the code there
> > >
> > > String code = mapping.getParameter();
> > >
> > >
> > > David Corbin wrote:
> > > >
> > > > I've got a an action "add", which requires a an argument "code".
> > > > One (at least) of the possible forwards needs to specify this "code"
on
> > the
> > > > forward URL.
> > > >
> > > > How can I do that?
> > > >
> > > > Thanks
> > > > David Corbin
>
>






___________________________________________________________________________
Visit http://www.visto.com.
Find out  how companies are linking mobile users to the 
enterprise with Visto.

Reply via email to