struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas De Loof" <>
Subject Re: How to set a parameter in an action
Date Thu, 16 Jan 2003 10:25:39 GMT
Servlet API doesn't allow you to write request attributes (parameters,

You can try to forward to a new ActionForward object, build with the mapping
to your "another" action, adding needed parameter with GET syntax :
return new ActionForward( NEXT_ACTION_URL + "?param=" + paramValue );
(I'm not sure it will work...)

Another solution is to put param value in request and forward to a JSP that
will redirect browser to the NEXT_ACTION_URL with param added :

# in your action:
request.setAttribute("param", paramValue);
return new ActionForward( "redirect.jsp" );

# redirect.jsp :
<form action="NEXT_ACTION_URL" method="POST">
  <input type="hidden" value="<% request.getAttribute("param") %>">


> Hi,
> in my action-class I can get a parameter from the request by using the
> method getParameter(String); from the class HttpServletRequest.
> But now I want to set a parameter (not an attribute) in my action and then
> make the forward so that another action can read this parameter.
> I need it because normally the action gets the parameter by the URL. But
> this special case I have to send the parameter by an action.
> ciao Oliver.
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message