当前位置: 代码迷 >> Java Web开发 >> 怎么取web根目录的绝对地址
  详细解决方案

怎么取web根目录的绝对地址

热度:51   发布时间:2016-04-17 12:52:58.0
如何取web根目录的绝对地址?
如何取web根目录的绝对地址?

------解决方案--------------------
request.getrealpath(request.getcontextpath)
------解决方案--------------------
String dir=this.servlet.getServletContext().getRealPath( "/ ");
------解决方案--------------------
看下这个
http://community.csdn.net/Expert/topic/5738/5738247.xml?temp=.6099512

可以用于不是request和servlet中
  相关解决方案