软件编程
位置:首页>> 软件编程>> java编程>> Java 获取Web项目相对webapp地址的实例

Java 获取Web项目相对webapp地址的实例

作者:紫薇帝星的故事  发布时间:2022-07-03 17:46:00 

标签:java,获取,Web,webapp

实例如下:


ServletRequestAttributes aRequestAttributes=(ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
  HttpServletRequest request =aRequestAttributes==null?null:aRequestAttributes.getRequest();
  String webpath=request.getServletContext().getRealPath("/");

来源:http://www.cnblogs.com/wdhwzm/p/7794568.html

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com