参数在哪里存储在Request Object中?

时间:2014-03-14 05:20:37

标签: java http debugging servlets request

我有以下代码行

request.getParameter("email");

在我检查这一行时进行调试时得到了所需的值,但当我检查整个请求对象时,我无法在 ParameterMap 中看到此值。

在请求对象中获取这些值的位置

我使用tomcat 6.0.34作为容器

1 个答案:

答案 0 :(得分:0)

Request parameters are extra information sent with the request. 
For HTTP servlets, parameters are contained in the query string or posted form data. If the parameter data was sent in the request body, then i occurs with an HTTP POST request.

在HTTP GET请求中,参数作为查询字符串发送:

http://example.com/page?parameter=value&also=another

检查以获取更多信息

Data from the query string and the post body are aggregated into the request parameter set. Query string data is presented BEFORE post body data. For example, if a request is made with a query string of a=hello and a post body of a=goodbye&a=world, the resulting parameter set would be ordered a=(hello, goodbye, world).

The following are the conditions that must be met before post FORM data will be populated to the parameter set:

The request is an HTTP or HTTPS request.

The HTTP method is POST.

The content type is application/x-www-form-urlencoded.

The servlet has made an initial call of any of the 'getParameter' family of methods on the request object.

If the conditions are not met and the post form data is not included in the parameter set, the post data must still be available to the servlet via the request object's input stream. If the conditions are met, post form data will no longer be available for reading directly from the request object's input stream.

http://www.javacertifications.net/javacert/HttpservletRequest.jsp

http://www.w3.org/TR/html401/interact/forms.html#h-17.13

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletRequest.html#getParameter(java.lang.String)

http://www.xyzws.com/Servletfaq/what-is-the-difference-between-the-request-attribute-and-request-parameter/1