js部分:
var jsonstr=getSearchSel(os);
var str = "";//传参数
for(var i in jsonstr){
if(jsonstr[i]!=""){
str += i+"="+jsonstr[i]+"&";
}
}
str = str.substr(0, str.length - 1);
var url = "/QAdevices/ExcelServlet?" + str;
window.open(url);
java端:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
StringBuilder jsonstr = new StringBuilder();//转化成json
jsonstr.append("{");
String reqstr = request.getQueryString();//获取请求参数
if(!"".equals(reqstr) &&reqstr !=null){
String [] stringArr= reqstr.split("&");
for(int i = 0;i<stringArr.length;i++){
String [] strArr = stringArr[i].split("=");
jsonstr.append("\""+strArr[0]+"\":"+"\""+strArr[1]+"\""+",") ;
}
jsonstr.deleteCharAt(jsonstr.length()-1);
}
jsonstr.append("}");
String filename =getExcelPath() ;
List<Map<String, Object>> searchlist = ServerInit.managerAction.searchDeviceInfoByConditions3(jsonstr.toString());
if(searchlist!=null){