The method getRealPath(String) from the type ServletRequest is deprecated 解決方法
摘要: (非原創)
The method getRealPath(String) from the type ServletRequest is deprecated
出現該警告,該方法已經不能使用了
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("/");
閱讀全文
The method getRealPath(String) from the type ServletRequest is deprecated
出現該警告,該方法已經不能使用了
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("/");
閱讀全文
posted @ 2010-12-30 11:04 kevin.zhan 閱讀(6728) | 評論 (0) 編輯