struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DurgaPrasad Guduguntla" <dgudu...@cisco.com>
Subject RE: Appending params to the URL of ActionForward
Date Fri, 06 Jun 2003 17:10:51 GMT
Thanks a lot! It worked perfectly.

Regards,

Durgaprasad

-----Original Message-----
From: Andrew Hill [mailto:andrew.david.hill@gridnode.com] 
Sent: Thursday, June 05, 2003 8:26 PM
To: Struts Users Mailing List
Subject: RE: Appending params to the URL of ActionForward


You can create a new action forward and return that.

The code below creates a new actionforward based on the path in an
existing one and appending some parameter:

ActionForward forward = mapping.findForward("myforward"); forward = new
ActionForward( addParameterToUrl(forward.getPath(),"foo","bar"),
forward.getRedirect() );
return forward;

where addParameterToUrl does something like:

  private String addParameterToURL(String url, String parameter, String
value)
  {
    return url + ( (url.indexOf("?")==-1) ? "?" : "&" ) + parameter +
"=" + value;
  }


-----Original Message-----
From: DurgaPrasad Guduguntla [mailto:dgudugun@cisco.com]
Sent: Friday, 6 June 2003 08:31
To: struts-user@jakarta.apache.org
Subject: Appending params to the URL of ActionForward


Hi,

I am new to struts and would like to know the solution to the following:

When the request is submitted to the action class, the action class will
evaluate and constructs the request parameters which needs to be
appended to URL of the View component mentioned in the forward target.

<action path="/process" type="SomeAction">
 <forward name = "success" path="jsp/content.jsp"/>
 <forward name = "failure" path="jsp/failure.jsp"/>
</action>

Depending upon the logic inside action class, there might be different
request parameters are obtained and the path of the url for the
"success" target should go like this:

 path = "jsp/content.jsp?param1=val1&param2=val2" (OR)
path="jsp/content.jsp?param3=val3&param4=val4"

Can we set the path for ActionForward by using
ActionForward.setPath()before returning inside Action class?  What could
be better approach to this problem?

Thanks,

Durgaprasad

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message