在java web中获取该项目的根路径

在jsp页面中:

<%

String path = application.getRealPath("").replace("\\","\\\\");

%>

在java代码中:

String path = request.getServletContext().getRealPath("").replace("\\","\\\\");

posted @ 2018-04-16 09:48  ppjj  阅读(336)  评论(0)    收藏  举报