在registerNetinfo.jsp页面中输入这些东东:
- <%=" ContextPath:"+request.getContextPath() %>
- <%=" RequestURI:"+request.getRequestURI() %>
- <%=" PathInfo:"+request.getPathInfo() %>
- <%=" LocalAddr:"+request.getLocalAddr() %>
- <%=" PathTranslated:"+request.getPathTranslated() %>
- <%=" QueryString:"+request.getQueryString() %>
- <%=" ServletPath:"+request.getServletPath() %>
输出结果
ContextPath:/superman
RequestURI:/superman/pages/registerNetinfo.jsp
PathInfo:null
LocalAddr:127.0.0.1
PathTranslated:null
QueryString:method=edit&flag=station
ServletPath:/pages/registerNetinfo.jsp
本文展示了如何使用JSP页面获取HTTP请求的各种属性,包括上下文路径、请求URI、本地地址等,通过具体示例帮助理解。

被折叠的 条评论
为什么被折叠?



