Then just add it on to the ActionForward returned from the Action ...
You can use the following method to do this:
protected ActionForward appendParam( String name, String value, ActionForward forward) {
StringBuffer path = new StringBuffer(forward.getPath()); boolean isQuery = (path.indexOf("?") >= 0); if (isQuery) path.append("&"); else path.append('?'); path.append(name); path.append('='); path.append(value);
return new ActionForward(path.toString(), forward.getRedirect()); }
If you place this method in a BaseAction, then you can call this in your ActionB's execute method ...
public ActionForward execute(...) { // stuff here ActionForward forward = mapping.findForward("success"); forward = appendParam("foo","bar",forward); return forward; }
Does that help?
Bill Siggelkow
nikhil walvekar wrote:
Hi, But my value will be dynamic in nature.
Nikhil
--- Bill Siggelkow <[EMAIL PROTECTED]> wrote: > Hi Nikhil,
It sounds like what you really want to do is set
add a request parameter name-value pair to the query string of the
URL. If so, then you can add these values directly in the definition
of the foward and still set redirect = "true" ... The example below
passes two parameters to ActionA -- foo=bar, and baz=blob -- note the use
of & to avoid XML confusion.
<action path="/ActionB" type="com.foo.MyAction"> <forward name="success" path="/ActionA.do?foo=bar&baz=blob"/> </action>
The <set-property> element is used to set a property
on the ForwardConfig object. Typically you only need to do
this if you are providing a custom implementation of the
ActionForward object.
nikhil walvekar wrote:
Hi, all
forward element is defined as following
<!ELEMENT forward (icon?, display-name?,
description?,
set-property*)>
actualy i want to pass some values to forward but
with
redirect true.
e.g.Action A expects one parameter..
I want to forward to action A from action B but
with
redirect true option. due to redirect=true i can
not
set required property from action B in request and
try
to read in action A.
Forward tag can have sub elements one of which is set-property.
Please help me, how can i use set-property in
forward
tag.
Nikhil.
________________________________________________________________________
Yahoo! India Matrimony: Find your partner online.
http://yahoo.shaadi.com/india-matrimony/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
=====
Nikhil
________________________________________________________________________ Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]