java 中拿项目路径
2024-09-10 18:19:57
public class ItemPathInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
request.setAttribute("itemPath", request.getContextPath());
return true;
}
}
或者直接引用 request.getContextPath();
这里的itemPath和前一篇的 ${pageContext.request.contextPath} 是一样的结果,我们可以用${itemPath}
最新文章
- 【XLL 框架库函数】 TempActiveCell/TempActiveCell12
- 用STM32CubeMX创建FreeRTOS项目
- HDU3727 - Jewel(主席树)
- 关于Java(介绍)
- ArcGIS Server 9.3 安装(win7).
- Spring源码地址和相关介绍的网址
- DOCKER 从入门到放弃(一)
- 懒人小技巧, Toad 常用偷懒方法
- Android 开发 倒计时功能 转载
- Oracle远程登录命令
- python之路----面向对象进阶二
- Python实现代码行数统计工具
- UVA LIVE-3263 - That Nice Euler Circuit
- linux centos 系统怎么设置中文模式
- mysql的.sql文件头部 /*!32312 IF NOT EXISTS*/;
- winsock的io模型(终极篇)
- 叙Windows平台下基于MBR和UEFI的bootkit(一)--以MBR为例
- SecureCRT配置文件保存和导入
- SOAPUI 压力测试的指标项说明
- 小程序swiper配置参数使用