你是不是要获取服务器端的路径,我给你提供下我写的方法你可以参考下:
/
获取服务器端的webapps路径
@return
/
public String findServerPath(){
String classPath = thisgetClass()getClassLoader()getResource("/")getPath();
try {
classPath =URLDecoderdecode(classPath, "gb2312");
} catch (UnsupportedEncodingException e) {
eprintStackTrace();
}
String[] strPath = classPathsplit("/");
String path = "";
for(int i = 0;i < strPathlength ; i++){
if(i > 0 && i <= 3){
path = path + strPath[i]+"/";
}
}
return path;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)