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

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827240
          • 排名 - 49

          最新評論

          閱讀排行榜

          評論排行榜

          代碼片段:       
          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) 評論(0)  編輯  收藏 所屬分類: javatomcat
          主站蜘蛛池模板: 汾阳市| 乐山市| 上思县| 随州市| 法库县| 济源市| 绥芬河市| 蒲城县| 鄂尔多斯市| 芒康县| 青田县| 栖霞市| 眉山市| 昭觉县| 保靖县| 孝感市| 长岛县| 阿鲁科尔沁旗| 西和县| 南郑县| 万源市| 武陟县| 泽州县| 永清县| 岳普湖县| 且末县| 会泽县| 苏州市| 哈巴河县| 玉溪市| 珲春市| 克拉玛依市| 双流县| 吐鲁番市| 东明县| 沐川县| 禄丰县| 榆中县| 平谷区| 肇东市| 连江县|