获取web项目中的webroot目录路径
2024-10-22 05:16:24
备忘,一段代码:
@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
logger.info("======begin web context====");
ServletContext context=arg0.getServletContext();
String webroot=context.getContextPath()+"/WebContent/";
context.setAttribute("webroot", webroot);
logger.info("webroot:"+webroot); }
在过滤器中获取的servletcontext。
最新文章
- 深入理解ConcurrentMap.putIfAbsent(key,value) 用法
- Bootstrap学习笔记系列2-------Bootstrap简单表格处理
- 编译mahout0.9
- (转)linux中fork()函数详解
- MongoDB - The mongo Shell, mongo Shell Quick Reference
- UITableViewCell实现3D缩放动画
- Linux命令:TOP
- 调试minix内核
- SQL Server 日志传送[转载]
- 对HI3531的GPIO使用的再分析
- C++内存分区
- 痞子衡嵌入式:ARM Cortex-M文件那些事(1)- 源文件(.c/.h/.s)
- SSM(Spring+springMVC+MyBatis)框架-springMVC实现图片上传
- vue循環語句
- 点击图片弹出input type=file选择器
- DotNetBar 中Ribbon汉化
- 关于urls 的基础
- 【java】之Method和Field反射获取和设置属性值
- asp.net core 使用identityServer4的密码模式来进行身份认证(2) 认证授权原理
- 分布式为什么使用Redis