前台数据{
id:'user_update',
text: '编辑',
maxWidth:55,
handler:function(){
var user_form = this.up('form');
if(user_form.getForm().isValid()){
user_form.getForm().submit({
// url: 'updateUserServlet',
url:'MyJsp.jsp',
method:'post',
submitEmptyText: false,
waitTitle:'请等待',
waitMsg: '正在编辑用户...',
params : {
id : userid,
userName : userName,
userPermiss : userPermiss,
description : description,
userPasswd : userPasswd
},
success:function(form,action){
var response = Ext.decode(action.response.responseText);
Ext.Msg.alert('提示', response.msg);
userStore.load();
},
failure:function(form,action){
Ext.Msg.alert('提示', '编辑用户失败!');
}
});
}else{
Ext.Msg.alert('提示', '数据验证失败!');
}
}
}
后台代码:<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="net.sf.json.*" %>
<%
BufferedReader in=request.getReader();
StringBuffer jsonStr=new StringBuffer();
String str="";
while((str=in.readLine())!=null){
jsonStr.append(str);
}
JSONObject jsonObj= JSONObject.fromObject(jsonStr.toString());
String name= jsonObj.getString("userName");
String msg="";
out.print("asdf");
out.print(name);
%>
服务器报错为:严重: Servlet.service() for servlet jsp threw exception
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of id=3&userName=yy&userPermiss=3&description=&userPasswd=usd1111
经过打印后,得到的数据为id=3&userName=yy&userPermiss=3&description=&userPasswd=usd1111不是json格式,请问哪里有问题??