Ext表单提交问题

pengpeng11 2008-11-10 11:26:48
我在前台页面用ext写了个表单提交给一个jsp进行验证,但jsp返回不了值给页面
jsp这样写的:

<%
String name = request.getParameter("name");
System.out.println(name);
//PrintWriter pw = response.getWriter();
if(name.equals("xx"))
{
//JSONValue v = new JSONValue();
//v.parse(name);
//System.out.println(v.toString());
//System.out.println("ok");
out.print("{success:true,msg:'ok'}");


}
...全文
177 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ghost_520 2008-11-11
  • 打赏
  • 举报
回复
你看下你的ext 页面上有没有下面两句话,有的话删掉,那是 非 Ajax 提交。

onSubmit: Ext.emptyFn,
submit: function() {
//有疑问的地方
this.getEl().dom.action='<%=path%>/init.do?param=login';
this.getEl().dom.submit();
},
pengpeng11 2008-11-10
  • 打赏
  • 举报
回复
我就是象这样写的啊

//提交到服务器操作
simple.form.doAction('submit',{
url:'check.jsp',//文件路径
method:'post',//提交方法post或get
params:'',
//提交成功的回调函数
success:function(form,action){
if (action.result.msg=='ok') {
document.location='index.html';
} else
{
Ext.Msg.alert('登入错误',action.result.msg);
}
},
//提交失败的回调函数
failure:function(){
Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
}
});
qintao1203 2008-11-10
  • 打赏
  • 举报
回复
form.getForm().submit({
success:function(form,action){

alert(action.result.msg);
}
})

返回的out.print("{success:true,msg:'ok'}");
在ext里应该action.result.XXXX来取
pengpeng11 2008-11-10
  • 打赏
  • 举报
回复
<%
String name = request.getParameter("name");
System.out.println(name);
//PrintWriter pw = response.getWriter();
if(name.equals("xx"))
{
//JSONValue v = new JSONValue();
//v.parse(name);
//System.out.println(v.toString());
//System.out.println("ok");
out.print("{success:true,msg:'ok'}");


}




%>

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧