您的位置:首页 > 产品设计 > UI/UE

request.getRealPath("/")过期问题

2014-10-29 13:41 369 查看
The method getRealPath(String) from the type ServletRequest is deprecated;

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

下面就是替代它的方法:

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

在servlet或者struts中还可以这样:

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

this.getServlet().getServletContext().getRealPath("/");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐