我正在开发包含某种基于Web的XML编辑器的Web应用程序。基本上我使用html textarea作为我的“编辑器”,当用户点击“保存”按钮时,包含修改XML的AJAX post请求被发送到服务器。我使用服务器端的$就功能发送大字符串时,Spring MVC ajax POST请求失败
function saveXML(){
var cm = editor.mirror;
var textXML = cm.getValue(); // textXML is a String representing edited XML
$.ajax({
url: "saveEditedBatch",
data: {xmlString: textXML},
type: 'POST',
success : function(response){
},
error : function(){
alert("error");
}
});
我控制器
@RequestMapping(value = "/saveEditedBatch", method = RequestMethod.POST)
public @ResponseBody JsonResponse saveEditedBatch(@RequestParam(value = "xmlString") String xmlString){
JsonResponse response = new JsonResponse();
byte[] byteXML = xmlString.getBytes();
byteXML = xmlAccess(new ByteArrayInputStream(byteXML));
// do something with byteXML
return response;
}
当我的XML,因此字符串我发送给服务器小 - 一切正常。但是,当XML很大时 - 即使我知道我传递了它,我也会得到“HTTP状态400 - 必需的字符串参数'xmlString'不存在”。我能做什么?
你使用什么应用程序服务器? – ragnor