现在的位置: 首页 > 综合 > 正文

getRealPath

2013年06月19日 ⁄ 综合 ⁄ 共 383字 ⁄ 字号 评论关闭

The method getRealPath(String) from the type ServletRequest is deprecated

request.getRealPath("") 这个方法 不推荐使用

 

Deprecated. As of Version 2.1 of the Java Servlet API, use ServletContext.getRealPath(java.lang.String) instead.

request.getSession().getServletContext().getRealPath() 得到站点的绝对地址


servlet或者struts中还可以这样:

this.getServletContext().getRealPath("/");

this.getServlet().getServletContext().getRealPath("/");

抱歉!评论已关闭.