因為專注,所以專業

          我的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 閱讀(6728) | 評論 (0)  編輯

          主站蜘蛛池模板: 巍山| 色达县| 盖州市| 安仁县| 乐安县| 建宁县| 哈巴河县| 丹巴县| 晋中市| 新密市| 精河县| 大丰市| 平阳县| 水城县| 巫山县| 治多县| 同德县| 平原县| 大田县| 新巴尔虎左旗| 江达县| 云林县| 兴城市| 图片| 普定县| 惠安县| 台南县| 汶上县| 嘉义县| 武平县| 思茅市| 长岛县| 若羌县| 辽宁省| 广丰县| 开远市| 乌苏市| 台北县| 汾西县| 通化市| 什邡市|