您的位置:首页 > 移动开发 > WebAPP

获取服务器端的webapps路径

2015-05-26 20:22 495 查看
/**
* 获取服务器端的webapps路径
* @return
*/
public String findServerPath(){
String classPath = this.getClass().getClassLoader().getResource("/").getPath();
try {
classPath =URLDecoder.decode(classPath, "gb2312");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String[] strPath = classPath.split("/");
String path = "";
for(int i = 0;i < strPath.length ; i++){
if(i > 0 && i <= 3){
path = path + strPath[i]+"/";
}
}
return path;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: