随笔 - 6  文章 - 129  trackbacks - 0
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿(14)

随笔档案(6)

文章分类(467)

文章档案(423)

相册

收藏夹(18)

JAVA

搜索

  •  

积分与排名

  • 积分 - 821414
  • 排名 - 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 阅读(2427) 评论(0)  编辑  收藏 所属分类: javatomcat

只有注册用户登录后才能发表评论。


网站导航: