Discussion:
jsp:forward adds params to query-string
Yves Glodt
2009-07-07 13:28:11 UTC
Permalink
Hi,

I have a simple jsp-page whose only purpose is to jsp:forward to my
main controller-servlet, here it is:

<%@ page session="true" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<jsp:forward page="/FormProcessor">
<jsp:param name="o" value="action1" />
</jsp:forward>

The problem I have is that the request comes as POST to the servlet,
but without the "o"-parameter.
The o-param instead comes as query-string o=action1

Note that the post-request comes from an external URL.

Does jsp:foward not preserve the original request? I would like to keep all POST

Best regards,
Yves
Bill Barker
2009-07-08 02:05:01 UTC
Permalink
Post by Yves Glodt
Hi,
I have a simple jsp-page whose only purpose is to jsp:forward to my
pageEncoding="UTF-8"%>
<jsp:forward page="/FormProcessor">
<jsp:param name="o" value="action1" />
</jsp:forward>
The problem I have is that the request comes as POST to the servlet,
but without the "o"-parameter.
The o-param instead comes as query-string o=action1
Yes, this is what is specified in the Servlet spec. A <jsp:param> adds the
parameter to the query-string.
Post by Yves Glodt
Note that the post-request comes from an external URL.
Does jsp:foward not preserve the original request? I would like to keep all POST
The POST parameters will still be available. What the Servlet will see
(using request.getParameter(String) and friends) is the union of the
query-string parameters and the POST parameters.

Of course, u could have found this out faster by testing it yourself ;).
Post by Yves Glodt
Best regards,
Yves
Yves Glodt
2009-07-09 07:07:20 UTC
Permalink
Thanks Bill for clarifying
Post by Yves Glodt
Hi,
I have a simple jsp-page whose only purpose is to jsp:forward to my
pageEncoding="UTF-8"%>
<jsp:forward page="/FormProcessor">
<jsp:param name="o" value="action1" />
</jsp:forward>
The problem I have is that the request comes as POST to the servlet,
but without the "o"-parameter.
The o-param instead comes as query-string o=action1
Yes, this is what is specified in the Servlet spec.  A <jsp:param> adds the
parameter to the query-string.
Post by Yves Glodt
Note that the post-request comes from an external URL.
Does jsp:foward not preserve the original request? I would like to keep all POST
The POST parameters will still be available.  What the Servlet will see
(using request.getParameter(String) and friends) is the union of the
query-string parameters and the POST parameters.
Of course, u could have found this out faster by testing it yourself ;).
Post by Yves Glodt
Best regards,
Yves
---------------------------------------------------------------------
Loading...