nishijia 2009-08-31 11:21
浏览 223
已采纳

EXT 的FormPanel submit 问题

我在一个window中放个formPanel 当我点提交后,后台能接收到表单数据,但是就是一直在读进度条,也没有返回success对话框。
[code="java"]
awin = new Ext.Window({
title: 'Add Requirment',
layout:'fit',
width:500,
height:300,
modal:true,
items: addButtonFP=new Ext.FormPanel({
labelAlign: 'left',
baseCls: 'x-plain',
labelWidth:120,
buttonAlign:'center',
bodyStyle:'padding:5px',
defaultType: 'textfield',
items: [{
fieldLabel: 'Requirement Name',
name: 'name',
anchor:'90%', // anchor width by percentage
allowBlank:false,
blankText:"not null"

                                },{ xtype: 'combo',
                                    fieldLabel: 'Priority',
                                    tpl: '<tpl for="."><div ext:qtip="{nick}" class="x-combo-list-item">{state}</div></tpl>',
                                    store: PriorityCombo,
                                    displayField:'state',
                                    emptyText:'Please choose...',
                                    selectOnFocus:true,
                                    triggerAction: 'all',
                                    mode: 'local',
                                    name: 'priority'
                                  //  anchor: '100%'  
                                },{
                                    xtype: 'textarea',
                                    fieldLabel: 'Description',
                                    name: 'desc',
                                    autocomplete:'on',
                                    anchor: '100% -53' 
                                }]
                            }),
                            buttons: [{
                                text:'Submit',
                                handler: function(){
                                var form=addButtonFP.getForm();
                                   if(form.isValid()){
                                         form.submit(
                                            {url:'reHandler.htm',
                                             waitMsg:'Saving data',//一直都在读这个进度条
                                             baseParams:{method:'addRes'}, //如果这行参数去掉就不会读进度条了
                                             method:'post',
                                             success:function(form,action){ 
                                                Ext.Msg.alert('Success',form.responseText); 
                                                this.refresh();
                                             },
                                             failure: function(){
                                                 Ext.Msg.alert('Failure','Please check'); 
                                             }
                                            }
                                         ); 
                                        }
                                }
                            },{
                                text: 'Cancel',
                                handler: function(){
                                    awin.hide();
                                }
                            }]
                        });
                        awin.show(this);

[/code]

我用的是spring 的MVC ,url 是要带个method的参数才能找到action的。这个该如何是好啊 有人遇到我这样的问题吗 还是我那里写错了?
[b]问题补充:[/b]
这个baseParams:{method:'addRes'}, 只是传个参数 参数名字可以变的,spring那里可以设置的
我 baseParams:{m:'addRes'},也是一样的 只想传个参数,现在的问题是 到达后台后返回前台时 一直在读进度条
[b]问题补充:[/b]
这里*.htm 也是在spring 那里设置的 你可以把它看作 *.do就可以了
我的后台是
[code="java"]
res.setContentType("text/html;charset=utf-8");

req.setCharacterEncoding("UTF-8");
System.out.println("entering--------------------");
System.out.println(req.getParameter("name")+"----------------------");
System.out.println(req.getParameter("priority")+"----------------------");
System.out.println(req.getParameter("desc")+"----------------------");
PrintWriter out = res.getWriter();
out.print("Success!");
out.flush();

out.close();
return new ModelAndView(main); //我这里写return null 都一样的效果
[/code]
这些都能打印出来 就是传到前台一直在读进度条
[b]问题补充:[/b]
debug 过了

missing ) in parenthetical
(Success!) ext-all.js (line 7)
难道是ext的bug?
[b]问题补充:[/b]
上图勒 不太会debug 是这样吗
[b]问题补充:[/b]
这个是我看 Rowen ,后台写的 out.print("success :true").
那该如何写呢 请指教

  • 写回答

9条回答 默认 最新

  • iteye_10013 2009-08-31 14:02
    关注

    out.print("{success :true}");

    需要去补下json的知识

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘