EXT form表单提交数据成功后,不进入success方法,这里我把数据提交到了test1.jsp页面
index.jsp页面
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var form=new Ext.form.FormPanel({
defaultType:'textfield',
labelAlign:'right',
title:'form',
labelWidth:50,
frame:true,
width:220,
url:'test1.jsp',
items:[{
fieldLabel:'文本框',
name:'content'
}],
buttons:[{
text:'提交',
handler:function()
{
form.getForm().submit({
success:function(from,action){
Ext.Msg.alert('信息',action.result.msg);
},
failure:function()
{
Ext.Msg.alert('错误','操作失败');
}
});
}
}]
});
form.render("con");
});
</script>
</head>
<body>
<div id="con"></div>
</body>
test1.jsp页面
<%
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String text=request.getParameter("content");
System.out.println(text); //测试是否接收到值
response.getWriter().println("{success:true}");
%>
------解决方案--------------------
success:function(from,action) 的from写错了,,应该是form