一般form里都会有复选框,我在提交form表单时,对于checkboxgroup的取值问题困扰了好一会儿了,特来这里请假一下。
1.第一种方式:
xtype: 'checkboxgroup',
columns: 3,
name:'hobbies',
items: [
{boxLabel: '足球', name: 'hobbie', inputValue: 1},
{boxLabel: '篮球', name: 'hobbie', inputValue: 2},
{boxLabel: '排球', name: 'hobbie', inputValue: 3},
{boxLabel: '游泳', name: 'hobbie', inputValue: 4},
{boxLabel: 'DOTA', name: 'hobbie', inputValue: 5}
]后台通过迭代得到的是: hobbie--->[reference:c0-e5,reference:c0-e6,reference:c0-e7], hobbies为null2.第二种方式:
xtype: 'checkboxgroup',
columns: 3,
name:'hobbies',
items: [
{boxLabel: '足球', name: 'football', inputValue:'1'},
{boxLabel: '篮球', name: 'basketball', inputValue: '2'},
{boxLabel: '游泳', name: 'swim', inputValue: '3'},
{boxLabel: 'DOTA', name: 'dota', inputValue: '4'},
{boxLabel: '乒乓球', name: 'ping-pong', inputValue: '5'}
这样提交到后台,得到的值是
basketball--->2
football--->1
dota--->4
hobbies还是为null。这样肯定不是我们想要的结果啊。。求指点~
1.第一种方式:
xtype: 'checkboxgroup',
columns: 3,
name:'hobbies',
items: [
{boxLabel: '足球', name: 'hobbie', inputValue: 1},
{boxLabel: '篮球', name: 'hobbie', inputValue: 2},
{boxLabel: '排球', name: 'hobbie', inputValue: 3},
{boxLabel: '游泳', name: 'hobbie', inputValue: 4},
{boxLabel: 'DOTA', name: 'hobbie', inputValue: 5}
]后台通过迭代得到的是: hobbie--->[reference:c0-e5,reference:c0-e6,reference:c0-e7], hobbies为null2.第二种方式:
xtype: 'checkboxgroup',
columns: 3,
name:'hobbies',
items: [
{boxLabel: '足球', name: 'football', inputValue:'1'},
{boxLabel: '篮球', name: 'basketball', inputValue: '2'},
{boxLabel: '游泳', name: 'swim', inputValue: '3'},
{boxLabel: 'DOTA', name: 'dota', inputValue: '4'},
{boxLabel: '乒乓球', name: 'ping-pong', inputValue: '5'}
这样提交到后台,得到的值是
basketball--->2
football--->1
dota--->4
hobbies还是为null。这样肯定不是我们想要的结果啊。。求指点~
解决方案 »
- 求ireport程序实例
- 急~在线等~jsp下载问题
- json onclick 方法传值
- JSF或者说JSP中怎么得到我的应用的根目录,比如我的程序在spmai目录下的,怎么在JSP中得到这个目录的
- 在MySql的Query Browser的工具中用insert into语句出现乱码?
- 关于自动课排课的算法问题
- 高分求实现此功能的代码!
- 有关路径问题 在jsp中的 文件是否存在file.exists()的监测和打开这个文件的疑惑
- 我在javabean里面显示图片的时候出现下面的问题:(急)
- jsp页面c:when问题
- Hibernate问题:update和insert语句很长时间才被执行
- 急救~fileupload上传文件到数据库问题
后台接受一个封装过来的map,迭代得到表单的各项信息的。
public void getFormInfo(Map formMap){
Set<Map.Entry<String, Object>> set = formMap.entrySet();
for (Iterator<Map.Entry<String, Object>> it = set.iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) it.next();
System.out.println(entry.getKey() + "--->" + entry.getValue());
}
System.out.println("hobbies "+formMap.get("hobbies"));
}