开发者

in jsp, get realPath of deployed project

in servlet, as we can access the real path of deployed project

ServletContext context = getServletConfig().getServletConte开发者_如何学Cxt();
string contextStr = context.getRealPath(".....");

How can i access the deployed project path in JSP page, any idea please ?


<%=request.getRealPath("write_your_file_name")%>


It should work just the same, for example by accessing ${pageContext.servletContext.getRealPath("...")} to get the same results. JSP are nothing more than servlets after they got compiled.


note, as of version 2.1 you should use

request.getServletContext().getRealPath("your_file_name")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜