HttpServletRequest 中 getRequestURL和getRequestURI的区别
比如说有这样的一个页面
test1.jsp=======================
<a href =”test.jsp?name=wf”>跳转到test2.jsp</a>
test2.jsp=======================
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
String servletPath = req.getRequestURI()
String servletPath = req.getRequestURL()
得到的值为:req.getRequestURI()—–>
/test/test.jsp
req.getRequestURL()—–>
http://localhost:8080/test/test.jsp