我在将值提交给 Spring MVC 中的控制器时遇到问题。
当我调用控制器并将href
其提交给控制器方法时,我提交了以下方式:
href='CIMtrek_Compliance_Daily_Shipments_Case_Pack_Calendar?date=<%=formatedDate%>'
但是当我通过 javascript 提交相同的内容时,我得到了这个异常The request sent by the client was syntactically incorrect.
这就是我通过 javascript 提交的方式:
function getCasePackCalendar(date) {
viewName ="CIMtrek_Compliance_Daily_Shipments_Case_Pack_Calendar?date="+date+" ";
global.forms[0].action = viewName;
global.forms[0].method = "GET"
global.forms[0].submit()
}
这是我的控制器方法:
@RequestMapping(value = "/CIMtrek_Compliance_Daily_Shipments_Case_Pack_Calendar", method = RequestMethod.GET)
public ModelAndView CIMtrek_Compliance_Daily_Shipments_Case_Pack_Calendar(@RequestParam("date") String date,HttpServletRequest request) {
String[] data = new String[] {date};
HttpSession session = request.getSession(true);
String UserName = "";
if(session.getAttribute("CIMtrek_UserName")!=null)
UserName = session.getAttribute("CIMtrek_UserName").toString();
ViewContent vc = new ViewContent();
String HTML = vc
.getContent(
"com/cim/xml/CIMtrek_Compliance_Daily_Shipments_Case_Pack_sql.xml",
"com/cim/xsl/view.xsl", "1 and 10","1","","0",UserName,data,"");
List<String> ls = new ArrayList<String>();
ls.add(HTML);
logger.info("Welcome CIMtrek_Visitors_By___Unipart_Div__Date__Host___Visitor!");
Map<String, Object> model = new HashMap<String, Object>();
model.put("list", ls);
model.put("iSPost", "N");
logger.info("Welcome CIMtrek_Compliance_Daily_Shipments_Case_Pack!");
return new ModelAndView("view", model);
}
这就是我的形式
<form id="CIMtrek_Compliance_Daily_Shipments">
<input type="hidden" id="CIMtrek_selectedIDs" name="CIMtrek_selectedIDs" value="" />
<input type="hidden" id="CIMtrek_xmlData" name="CIMtrek_xmlData" value="" />
<input type="hidden" id="CIMtrek_formName" name="CIMtrek_formName" value="CIMtrek_Compliance_Daily_Shipments" />
</form>
可能是什么问题呢。
请帮我找到它。
最好的祝福。