要獲得地址前半部分,如http://192.168.0.0:8080這個字符串
String path1 = ServletActionContext.getRequest().getRequestURL().toString();
http://192.168.0.0:8080/12319/callRecord/list.do
String path2 = ServletActionContext.getRequest().getRequestURI().toString();
/12319/callRecord/list.do
然後將兩個string相減
String path3 = path2.replaceAll(path1, "");
此時就獲得了地址的前半部分path3