bug 调试了一个下午外加半个晚上的bug
public void queryTaskResult2() throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); PrintWriter out = response.getWriter(); String newsIdselect = request.getParameter("newsIdselect"); String taskname = request.getParameter("taskname"); String result = "{success:true,totalProperty: " + 1 + ",root:[{"; String mmsAccessResult=null; if (newsIdselect != null && !"".equals(newsIdselect)) { List<AssessBeforeResult> abrList = assessBeforeResultService.findAssessResultByTaskId(Integer.valueOf(newsIdselect)); if(abrList!=null&&abrList.size()>0) { for (int i = 0; i < abrList.size(); i++) { AssessBeforeResult abr = abrList.get(i); if(abr.getSampleType()==2) { System.out.println(abr.getMmsLeakage()); mmsAccessResult = "mmsTaskId:'" + newsIdselect + "',mmsResultId:'"+ abr.getId() + "',mmsTaskName:'" + taskname + "',mmsPrecision:'" + abr.getMmsPrecision()+ "%'" + " ,mmsRecall:'" + abr.getMmsRecall()+ "%'" + " ,mmsErrorrate:'" + abr.getMmsErrorrate()+ "%'" //+ " ,mmsLeakage:'" + abr.getMmsLeakage()+ "%'"; + " ,mmsLeakage:'11'"; } } } } System.out.println(mmsAccessResult); if(mmsAccessResult!=null) { result+=mmsAccessResult; } result+=",textPrecision:'"+ "7" + "',textRecall:'"+ "8" + "',textErrorrate:'"+ "9" + "',textLeakage:'"+ "10"; result+="'}]}"; String updateString = "{success:true,totalProperty: 1,root: [{" + "mmsTaskId:'"+"0" + "',mmsResultId:'"+ "1" + "',mmsTaskName:'"+ "2" + "',mmsPrecision:'"+ "3" + "',mmsRecall:'"+ "4" + "',mmsErrorrate:'"+ "5" + "',mmsLeakage:'"+ "6" + "',textPrecision:'"+ "7" + "',textRecall:'"+ "8" + "',textErrorrate:'"+ "9" + "',textLeakage:'"+ "10" + "'}]}"; System.out.println(result); System.out.println(updateString); //out.println(updateString); out.println(result); out.flush(); out.close(); }
这个问题我调试了好几个小时,就因为前面多了一个“ ’ ”这个符号,输出样例如下
{ success: true, totalProperty: 1, root: [ { mmsTaskId: '50', mmsResultId: '44', mmsTaskName: '???é?????è???????????è???¨?é??è????°', mmsPrecision: '25.0%', mmsRecall: '16.67%', mmsErrorrate: '0.0%', mmsLeakage: '83.33%'', textPrecision: '7', textRecall: '8', textErrorrate: '9', textLeakage: '10' } ] }{ success: true, totalProperty: 1, root: [ { mmsTaskId: '0', mmsResultId: '1', mmsTaskName: '2', mmsPrecision: '3', mmsRecall: '4', mmsErrorrate: '5', mmsLeakage: '6', textPrecision: '7', textRecall: '8', textErrorrate: '9', textLeakage: '10' } ] }