我正在開發包含某種基於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