HttpServletRequest request 相关方法 得到路径

//--------------------------POST---------------
username=qqqq
password=wwww

http://192.168.1.211:8080/demo/index.jsp
------------------------------------------------>
request.getContextPath() =/demo
request.getMethod() =POST
request.getRequestURI() =/demo/reg
request.getRequestURL() =http://192.168.1.211:8080/demo/reg
request.getServletPath() =/reg
//-----------------------GET------------------->
http://192.168.1.211:8080/demo/index.jsp?username=1&password=1&email=1
request.getContextPath() =/demo
request.getMethod() =GET
request.getQueryString() =username=1&password=1&email=1
request.getRequestURI() =/demo/index.jsp
request.getRequestURL() =http://192.168.1.211:8080/demo/index.jsp
request.getServletPath() =/index.jsp

你可能感兴趣的:(HttpServletRequest request 相关方法 得到路径)