jsp中request 中 get 路径的几个常用方法返回的值:
从 index.html 请求到 reg.jsp
request.getRequestURL().toString() ;
显示:http://220.115.77.126/myservlet/reg.jsp
request.getRequestURI();
显示:/myservlet/reg.jsp
request.getContextPath();
显示:/myservlet (即工程别名)
request.getLocalAddr();
显示:220.115.77.126
request.getLocalName();
显示:220.115.77.126
request.getLocalPort();
显示:220.115.77.126
request.getRealPath("reg.jsp");
显示:E:\Tomcat 5.5\webapps\myservlet\reg.jsp
request.getRemoteAddr();
显示:220.115.77.126
request.getRemoteHost();
显示:220.115.77.126
request.getRemotePort();
显示:3567
request.getScheme();
显示:http
request.getServerName();
显示:220.115.77.126
request.getServerPort();
显示:80
request.getServletPath();
显示:/reg.jsp