問題:前台表單用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种接收的参数:
#