问题:前台表单用ajax提交,data为validateForm.serializeArray(),后台用实体类接收参数,&符号被转义为&但是从request中直接取值是没问题的,请问如何解决实体类接收到的参数的转义问题。
代码如下:
前台代码:
var formData = validateForm.serializeArray();
$.ajax({
type: 'POST',
cache: false,
url: basepath + "/newProjectAdjustment/saveProjectAdjustmentInfo.do",
data: formData,
dataType: "json",
async:false,
success: function (result) {
if (result.success) {
saveFlag = true;
} else {
parent.$.messager.alert("提示", result.msg != "操作成功" ? result.msg : projMessage.get("C008"), "info");
}
},
error: function (result) {
parent.$.messager.alert("提示", projMessage.get("C008"), "info");
}
});
return saveFlag;
后端代码:
@RequestMapping(value = "saveProjectAdjustmentInfo.do", method = RequestMethod.POST)
@ResponseBody
public AjaxJson saveProjectAdjustmentInfo(HttpServletRequest request, ProjectAdjustmentDTO projectAdjustmentInfo) throws InvocationTargetException, IllegalAccessException {
Map params = FormFormatterUtil.formatFrom2Map(request);
AjaxJson result = new AjaxJson();
return result;
}
Debug:
这是实体类中接收的参数:
这是request种接收的参数: