request對象url方法

JSP開發中request對象URL方法對照表

以 Tomcat 服務器「http://localhost:8080/vote/test.jsp」爲例說明:

request.getScheme() —— http
request.getServerName() —— localhost
request.getServerPort() —— 8080
request.getContextPath() —— /vote
request.getProtocol() —— HTTP/1.1
request.getRemoteAddr() —— 127.0.0.1
request.getRemoteHost() —— 127.0.0.1
request.getRemotePort() —— 1316
request.getRequestURI() —— /vote/test.jsp
request.getRequestURL() —— http://localhost:8080/vote/test.jsp
request.getServletPath() —— /test.jsp
 服務器

相關文章
相關標籤/搜索