2017-09-05 17:05:47
Fetch URL
request.getRequestURL()
Parameter List
Request in
GET
1
2
3http://localhost:8070/serverLab/hello?a=1&b=2
request.getQueryString()
result: a=1&b=2Request in
POST
orGET
getParameter()
This method limited in form’s encoding
only used inapplication/x- www-form-urlencoded
Advantage is very simple, disadvantage is not suit in big data.
When transfer big data block browser usemultipart/form-data
getInputStream()
getReader()
Get context by stream, got bytes or characters
Stream way have conflict with parameter way
When getParameter()
read a from encoded by application/x- www-form-urlencoded
oncegetInputStream()
can’t read data any more.vice versa.
When getParameter()
read a from encoded by multipart/form-data
, can’t read data
So multipart/form-data
encoding have no conflict.
PS. request.getInputStream()
request.getReader()
can’t use in mix or throw exception
About request.getAttribute()
- Attribute is survive in container
- HttpServletRequest only have
setAttribute()
onsetParameter()
- Survive in one request, like
forward
session.setAttribute()
have Affect in a progress- If from’s data come’s from JS, use a hidden div parse data -_-!!!