首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

web项目,取得根路径,在普通类中

2012-12-23 
web项目,获得根路径,在普通类中/*** 得到WebRoot文件夹下的根路径,及web项目的根路径* @return*/publicStr

web项目,获得根路径,在普通类中

/**  * 得到WebRoot文件夹下的根路径,及web项目的根路径  * @return  */  public  String getWebRootAbsolutePath() {           String path = null;           String folderPath = Path.class.getProtectionDomain().getCodeSource()                   .getLocation().getPath();           if (folderPath.indexOf("WEB-INF") > 0) {               path = folderPath.substring(0, folderPath                       .indexOf("WEB-INF"));            }           return path;  }  

?

热点排行
Bad Request.