- //获取当前we站点的路径(在做上传下载的时候,可以使用)
- private String getWebpath (HttpServletRequest request){
- //return request.getSession().getServletContext().getRealPath();
- //return request.getServletContext().getRealPath("");
- return request.getRealPath();
- }
获取当前web站点路径
最新推荐文章于 2022-12-20 20:39:01 发布
本文介绍了一种通过HttpServletRequest对象获取当前Web应用路径的方法。该方法利用request.getRealPath()直接返回Web应用的绝对路径,这对于实现文件上传下载等功能非常实用。
1381

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



