servlet里经常会用到的一些GET方法
来源:互联网 发布:单片机好学吗 编辑:程序博客网 时间:2024/05/14 02:46
servlet里经常会用到一些GET方法,容易弄混,把它们记在这儿了。
servletContext.getContextPath()=
servletContext.getRealPath("/")=F:\ess-branch\web\
servletContext.getRealPath("")=F:\ess-branch\web
servletContext.getContextPath()=
servletContext.getServerInfo()=Apache Tomcat/6.0.18
servletContext.getResource("/")=jndi:/localhost/
httpServletRequest.getContextPath()=
httpServletRequest.getLocalAddr()=127.0.0.1
httpServletRequest.getLocalName()=localhost
httpServletRequest.getLocalPort()=8090
httpServletRequest.getPathInfo()=null
httpServletRequest.getPathTranslated()=null
httpServletRequest.getProtocol()=HTTP/1.1
httpServletRequest.getQueryString()=null
httpServletRequest.getRealPath("")已过时=F:\ess-branch\web
httpServletRequest.getRemoteAddr()=127.0.0.1
httpServletRequest.getRemoteHost()=127.0.0.1
httpServletRequest.getRemotePort()=3288
httpServletRequest.getRemoteUser()=null
httpServletRequest.getRequestURI()=/support/indexinfo/uploadPicture.htm
httpServletRequest.getRequestURL()=http://localhost:8090/support/indexinfo/uploadPicture.htm
httpServletRequest.getScheme()=http
httpServletRequest.getServerName()=localhost
httpServletRequest.getServerPort()=8090
httpServletRequest.getServletPath()=/support/indexinfo/uploadPicture.htm
httpServletRequest.getUserPrincipal()=null
ServletContext servletContext = ActionContext.getServletContext();
HttpServletRequest httpServletRequest = ActionContext.getRequest();
if (servletContext == null) {
System.out.println("servletContext is null");
}
if (httpServletRequest == null) {
System.out.println("httpServletRequest is null");
}
System.out.println("servletContext.getContextPath()="
+ servletContext.getContextPath());
System.out.println("servletContext.getRealPath(\"/\")="
+ servletContext.getRealPath("/"));
System.out.println("servletContext.getRealPath(\"\")="
+ servletContext.getRealPath(""));
System.out.println("servletContext.getContextPath()="
+ servletContext.getContextPath());
System.out.println("servletContext.getServerInfo()="
+ servletContext.getServerInfo());
try {
System.out.println("servletContext.getResource(\"/\")="
+ servletContext.getResource("/"));
}
catch (MalformedURLException e) {
e.printStackTrace();
}
// httpServletRequest
System.out.println("httpServletRequest.getContextPath()="
+ httpServletRequest.getContextPath());
System.out.println("httpServletRequest.getLocalAddr()="
+ httpServletRequest.getLocalAddr());
System.out.println("httpServletRequest.getLocalName()="
+ httpServletRequest.getLocalName());
System.out.println("httpServletRequest.getLocalPort()="
+ httpServletRequest.getLocalPort());
System.out.println("httpServletRequest.getPathInfo()="
+ httpServletRequest.getPathInfo());
System.out.println("httpServletRequest.getPathTranslated()="
+ httpServletRequest.getPathTranslated());
System.out.println("httpServletRequest.getProtocol()="
+ httpServletRequest.getProtocol());
System.out.println("httpServletRequest.getQueryString()="
+ httpServletRequest.getQueryString());
System.out.println("httpServletRequest.getRealPath(\"\")已过时="
+ httpServletRequest.getRealPath(""));
System.out.println("httpServletRequest.getRemoteAddr()="
+ httpServletRequest.getRemoteAddr());
System.out.println("httpServletRequest.getRemoteHost()="
+ httpServletRequest.getRemoteHost());
System.out.println("httpServletRequest.getRemotePort()="
+ httpServletRequest.getRemotePort());
System.out.println("httpServletRequest.getRemoteUser()="
+ httpServletRequest.getRemoteUser());
System.out.println("httpServletRequest.getRequestURI()="
+ httpServletRequest.getRequestURI());
System.out.println("httpServletRequest.getRequestURL()="
+ httpServletRequest.getRequestURL());
System.out.println("httpServletRequest.getScheme()="
+ httpServletRequest.getScheme());
System.out.println("httpServletRequest.getServerName()="
+ httpServletRequest.getServerName());
System.out.println("httpServletRequest.getServerPort()="
+ httpServletRequest.getServerPort());
System.out.println("httpServletRequest.getServletPath()="
+ httpServletRequest.getServletPath());
System.out.println("httpServletRequest.getUserPrincipal()="
+ httpServletRequest.getUserPrincipal());
#j2ee开发
(责任编辑:SQL吧信息编辑)
本文引自:SQL吧|企业网站源码下载(www.sql8.net) 原文参考:http://www.sql8.net/a/course/chengxu/java/servlet/2014/0620/25822.html
servletContext.getContextPath()=
servletContext.getRealPath("/")=F:\ess-branch\web\
servletContext.getRealPath("")=F:\ess-branch\web
servletContext.getContextPath()=
servletContext.getServerInfo()=Apache Tomcat/6.0.18
servletContext.getResource("/")=jndi:/localhost/
httpServletRequest.getContextPath()=
httpServletRequest.getLocalAddr()=127.0.0.1
httpServletRequest.getLocalName()=localhost
httpServletRequest.getLocalPort()=8090
httpServletRequest.getPathInfo()=null
httpServletRequest.getPathTranslated()=null
httpServletRequest.getProtocol()=HTTP/1.1
httpServletRequest.getQueryString()=null
httpServletRequest.getRealPath("")已过时=F:\ess-branch\web
httpServletRequest.getRemoteAddr()=127.0.0.1
httpServletRequest.getRemoteHost()=127.0.0.1
httpServletRequest.getRemotePort()=3288
httpServletRequest.getRemoteUser()=null
httpServletRequest.getRequestURI()=/support/indexinfo/uploadPicture.htm
httpServletRequest.getRequestURL()=http://localhost:8090/support/indexinfo/uploadPicture.htm
httpServletRequest.getScheme()=http
httpServletRequest.getServerName()=localhost
httpServletRequest.getServerPort()=8090
httpServletRequest.getServletPath()=/support/indexinfo/uploadPicture.htm
httpServletRequest.getUserPrincipal()=null
ServletContext servletContext = ActionContext.getServletContext();
HttpServletRequest httpServletRequest = ActionContext.getRequest();
if (servletContext == null) {
System.out.println("servletContext is null");
}
if (httpServletRequest == null) {
System.out.println("httpServletRequest is null");
}
System.out.println("servletContext.getContextPath()="
+ servletContext.getContextPath());
System.out.println("servletContext.getRealPath(\"/\")="
+ servletContext.getRealPath("/"));
System.out.println("servletContext.getRealPath(\"\")="
+ servletContext.getRealPath(""));
System.out.println("servletContext.getContextPath()="
+ servletContext.getContextPath());
System.out.println("servletContext.getServerInfo()="
+ servletContext.getServerInfo());
try {
System.out.println("servletContext.getResource(\"/\")="
+ servletContext.getResource("/"));
}
catch (MalformedURLException e) {
e.printStackTrace();
}
// httpServletRequest
System.out.println("httpServletRequest.getContextPath()="
+ httpServletRequest.getContextPath());
System.out.println("httpServletRequest.getLocalAddr()="
+ httpServletRequest.getLocalAddr());
System.out.println("httpServletRequest.getLocalName()="
+ httpServletRequest.getLocalName());
System.out.println("httpServletRequest.getLocalPort()="
+ httpServletRequest.getLocalPort());
System.out.println("httpServletRequest.getPathInfo()="
+ httpServletRequest.getPathInfo());
System.out.println("httpServletRequest.getPathTranslated()="
+ httpServletRequest.getPathTranslated());
System.out.println("httpServletRequest.getProtocol()="
+ httpServletRequest.getProtocol());
System.out.println("httpServletRequest.getQueryString()="
+ httpServletRequest.getQueryString());
System.out.println("httpServletRequest.getRealPath(\"\")已过时="
+ httpServletRequest.getRealPath(""));
System.out.println("httpServletRequest.getRemoteAddr()="
+ httpServletRequest.getRemoteAddr());
System.out.println("httpServletRequest.getRemoteHost()="
+ httpServletRequest.getRemoteHost());
System.out.println("httpServletRequest.getRemotePort()="
+ httpServletRequest.getRemotePort());
System.out.println("httpServletRequest.getRemoteUser()="
+ httpServletRequest.getRemoteUser());
System.out.println("httpServletRequest.getRequestURI()="
+ httpServletRequest.getRequestURI());
System.out.println("httpServletRequest.getRequestURL()="
+ httpServletRequest.getRequestURL());
System.out.println("httpServletRequest.getScheme()="
+ httpServletRequest.getScheme());
System.out.println("httpServletRequest.getServerName()="
+ httpServletRequest.getServerName());
System.out.println("httpServletRequest.getServerPort()="
+ httpServletRequest.getServerPort());
System.out.println("httpServletRequest.getServletPath()="
+ httpServletRequest.getServletPath());
System.out.println("httpServletRequest.getUserPrincipal()="
+ httpServletRequest.getUserPrincipal());
#j2ee开发
(责任编辑:SQL吧信息编辑)
本文引自:SQL吧|企业网站源码下载(www.sql8.net) 原文参考:http://www.sql8.net/a/course/chengxu/java/servlet/2014/0620/25822.html
0 0
- servlet里经常会用到的一些GET方法
- servlet里经常会用到一些GET方法
- 一些经常会用到的原生JS方法
- 经常用到的一些js方法
- Velocity经常要用到的一些方法
- 微信开发经常会用到的一些方法,做一次总结,以后直接过来拿
- 一些经常会用到的Javascript检测函数
- 一些经常会用到的Javascript检测函数
- 一些经常会用到的vbscript检测函数
- 一些经常会用到的Javascript检测函数
- 一些经常会用到的Javascript检测函数
- 一些经常会用到的Javascript检测函数
- Makefile 中经常会用到一些内置的标准变量
- php.ini中经常会用到的一些配置
- web前端-工作中经常会用到的一些样式
- 做网站经常会用到的一些js效果
- 做网站经常会用到的一些js效果
- IOS开发--经常会用到的方法和常识
- 液晶显示屏基础知识
- 图书馆管理系统
- 有你,情暖飘香
- 众包模式的困境
- setAnimatjionStyle实现popupwindow的动画效果
- servlet里经常会用到的一些GET方法
- js动态时钟
- “ant debug install” 出错: sdk.dir is missing. Make sure....
- 业内人说:后媒体时代,我们需要怎样的创业者?
- hdu 1532 Drainage Ditches(最大流)
- 《设计师要懂心理学》摘要
- sqlite3 C简单编程实例
- form表单转换为json对象
- 关于注释