隨筆 - 6  文章 - 129  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊(cè)

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827222
          • 排名 - 49

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          代碼片段:       
          String prefix = config.getServletContext().getRealPath("/");

                  if (prefix == null || prefix.equals("")) {
                    // deployment in weblogic through ear file does not deploy
                    // phisically
                    // the files,
                    // so we need to obtain the path through getClass method
                    java.net.URL url = this.getClass().getResource("/");
                    String mSchemaPath = url.getFile();
                    if (mSchemaPath != null || !mSchemaPath.equals("")) {
                      String separator = "/";
                      int lastSlash = mSchemaPath.lastIndexOf(separator);
                      if (lastSlash == -1) {
                        separator = "\\";
                        lastSlash = mSchemaPath.lastIndexOf(separator);
                      }
                      prefix = mSchemaPath.substring(0, lastSlash);
                      prefix = prefix.substring(0, prefix.lastIndexOf(separator));
                      prefix = prefix.substring(0, prefix.lastIndexOf(separator) + 1);
                      // lastSlash = mSchemaPath.lastIndexOf(separator);
                      // mSchemaPath = mSchemaPath.substring(0, lastSlash);
                      // lastSlash = mSchemaPath.lastIndexOf(separator);
                      // prefix = mSchemaPath.substring(0, lastSlash+1);
                    }
                  }


          posted on 2010-12-03 22:06 Ke 閱讀(2435) 評(píng)論(0)  編輯  收藏 所屬分類: javatomcat
          主站蜘蛛池模板: 孝义市| 铁岭市| 祁阳县| 和平区| 华蓥市| 广南县| 莫力| 夏邑县| 香港| 新乡市| 恭城| 乾安县| 淄博市| 江津市| 台山市| 沅江市| 宜黄县| 新野县| 岳西县| 沁源县| 区。| 太白县| 成都市| 顺昌县| 托里县| 河源市| 区。| 遂昌县| 大渡口区| 高邮市| 白水县| 乡宁县| 马山县| 曲靖市| 康保县| 泰和县| 三明市| 九江市| 汉川市| 诸城市| 宜良县|