因為專注,所以專業

          我的Java Blog

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            21 隨筆 :: 30 文章 :: 6 評論 :: 0 Trackbacks

          12 2010 檔案

          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("/");
            閱讀全文

          posted @ 2010-12-30 11:04 kevin.zhan 閱讀(6739) | 評論 (0)  編輯

          主站蜘蛛池模板: 仁怀市| 渝中区| 博湖县| 隆回县| 项城市| 东乡| 封开县| 台南县| 花莲市| 伊金霍洛旗| 沁水县| 林甸县| 益阳市| 芦山县| 泾阳县| 惠水县| 额敏县| 沙坪坝区| 平远县| 哈尔滨市| 鸡泽县| 宁陕县| 镇平县| 广河县| 定安县| 新干县| 特克斯县| 高雄市| 信宜市| 永年县| 灵川县| 叶城县| 始兴县| 莫力| 邳州市| 丹阳市| 鄢陵县| 横峰县| 综艺| 镇原县| 甘谷县|