ServletContext获取项目真实路径
2015-07-24 09:01
274 查看
import javax.servlet.ServletContext;
import org.springframework.web.context.ServletContextAware;
/**
* @author Administrator
*
*/
public class PayUtil implements ServletContextAware{
public ServletContext context ;
public static String PATH = "";
/* (non-Javadoc)
* @see org.springframework.web.context.ServletContextAware#setServletContext(javax.servlet.ServletContext)
*/
public void setServletContext(ServletContext context) {
this.context = context;
}
public void myinit(){
PayUtil.PATH = context.getRealPath("");
}
}
PayUtil.PATH = D:\work\apache-tomcat-7.0.52\webapps\pra
import org.springframework.web.context.ServletContextAware;
/**
* @author Administrator
*
*/
public class PayUtil implements ServletContextAware{
public ServletContext context ;
public static String PATH = "";
/* (non-Javadoc)
* @see org.springframework.web.context.ServletContextAware#setServletContext(javax.servlet.ServletContext)
*/
public void setServletContext(ServletContext context) {
this.context = context;
}
public void myinit(){
PayUtil.PATH = context.getRealPath("");
}
}
PayUtil.PATH = D:\work\apache-tomcat-7.0.52\webapps\pra
相关文章推荐
- 把本地jar包发布到maven私服和本地maven库
- Python的Django框架中模板碎片缓存简介
- 用C语言操作MySQL数据库的通用方法
- 跨域资源共享(CORS)
- 我的博客搬家了,欢迎来玩
- MySQL数据库引擎介绍、区别、创建和性能测试的深入分析
- 深入理解Memcached原理
- 深入理解Memcached原理
- 深入理解Memcached原理
- C++ map 的基本操作和使用
- 顺序表的各种操作以及合并
- sql Server 2008 express 版登录名
- DAO和Service层的一些解释
- 净空法师:年轻时候好,是你前生所修的
- 在 windows 上折腾 GitHub
- Memcached客户端-XMemcached使用
- windows下安装redis
- Url 传递中文 加密
- Memcached客户端-XMemcached使用
- ContentProvider的使用(2)