Spring MVC中得到Web应用的根路径
2018-01-26 17:20
393 查看
import org.springframework.web.context.ContextLoader; import javax.servlet.ServletContext; /** * Created by Gong_Yi on 2018/1/26. */ public class G { String webRootUrl = "/"; ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); String webRootPath = servletContext.getRealPath(webRootUrl); }
相关文章推荐
- Spring mvc怎么获取当前应用的url地址?即jsp页面中的${contextpath}怎么得到?
- Spring mvc怎么获取当前应用的url地址?即jsp页面中的${contextpath}怎么得到?
- JavaWeb_Servlet_应用_路径中文字符处理
- java 动态获取web应用的部署路径
- Spring MVC程序中得到静态资源文件css,js,图片 文件的路径
- struts改变应用路径后,web程序中需要注意修改的几个地方
- rails技巧之得到web应用中的web服务器地址和端口号
- Tomcat下获取web应用的绝对路径
- 如何获取web应用的部署路径(多种方式)
- Weblogic web应用中获取文件的绝对路径
- 在java应用程序和web应用中的相对路径问题
- Web应用中获得文件夹的物理路径
- javaweb基础 01--JSP取得绝对路径应用
- Tomcat下获取web应用的绝对路径
- Spring MVC程序中得到静态资源文件css,js,图片文件的路径问题总结
- 使用Spring MVC3构建Web应用详细教程
- Spring MVC配置Freemarker全局变量,实现应用全路径
- 【转帖】【Web】HttpServletRequest request 相关方法 得到路径
- 路径的转换:本地web应用部署到sae中的路径转换
- JAVA X项目得到WEB—INFO上级目录路径