1.截取linux文件存储路径方法
package com.tydic.eshop.action.freemarker; public class dddd { public static void main(String[] args) {
String strParentUrl = "/home/tomcat7/ecp/t8086/webapps/ecp/FreeMarker/1463766670142/error/html/index.html";
String[] s = strParentUrl.split("/");
String ddd = display(s,8,s.length);
System.out.println(ddd); } public static String display(String[] str,int a,int b) {
StringBuffer sb = new StringBuffer();
for(int i=a;i<b;i++) {
sb.append("/"+str[i]);
}
String requestString = sb.toString().substring(1, sb.toString().length());
return requestString; }
}