3.1.1 When Parameters Are Available
The following are the conditions that mustbe met before post form data will be
populated to the parameter set:
1. The request is an HTTP or HTTPS request.
2. The HTTP method is POST.
3. The content type is application/x-www-form-urlencoded.
4. The servlet has made an initial call of any of the getParameterfamily 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.
經過翻譯servlet上面一段規範如下:
根據Servlet規範,如果同時滿足下列條件,則請求體(Entity)中的表單數據,將被填充到request的parameter集合中(request.getParameter系列方法可以讀取相關數據):
1 這是一個HTTP/HTTPS請求
2 請求方法是POST(querystring無論是否POST都將被設置到parameter中)
3 請求的類型(Content-Type頭)是application/x-www-form-urlencoded
4 Servlet調用了getParameter系列方法