springmvc checkboxes 回显问题
2015-09-10 16:43
453 查看
**.java pubic String test(Model model,User user,HttpServletRequest request,HttpServletResponse response,String channel) { List<User> ctList = querylist(channel); String s= tntProm.getDistributor(); List<String> list = new ArrayList<String>(); if(s!=null && !s.equals("")) { String[] s = s.split(","); for(String temp : s) { if(temp != null &&temp.length() != 0){ list.add(temp); } } } Map<String, String> map_id = new HashMap<String, String>(); String tempId = ""; String tempName = ""; for(int i = 0;i<ctList.size();i++) { tempId = String.valueOf(ctList.get(i).getUserId()); tempName = ctList.get(i).getRealName(); map_id.put(tempId,tempName); } //user是po对象,其中list是传到前台需要自动勾选的,而map是所有的复选框选项 user.setList(list); model.addAttribute("user", user); model.addAttribute("map", map_id); return "/test/edit"; }
.jsp <table > <tbody> <tr> <td>关键词:</td> <td><sf:input path="key" onfocus="this.blur()"/></td> </tr> <tr> <td>ID:</td> <td><sf:input path="id" id="id"/></td> </tr> <tr> <td><span>渠道: </span></td> <td><sf:checkboxes items="${map}" path="list" cssClass="required"/></td> </tr> </tbody> </table>
相关文章推荐
- jQuery根据ID获取input、checkbox、radio、select的示例
- jquery实现的代替传统checkbox样式插件
- asp.net动态产生checkbox(数据源为DB或内存集合)
- asp.net gridview中用checkbox全选的几种实现的区别
- asp.net treeview checkbox 相关问题
- IE中checkbox在刷新后初始化的问题
- 浅谈checkbox的一些操作(实战经验)
- asp.C#实现图片文件与base64string编码解码
- 多个datatable共存造成多个表格的checkbox都被选中
- javascript使用shift+click实现选择和反选checkbox的方法
- JS选中checkbox后获取table内一行TD所有数据的方法
- 用Javascript读取CheckBox数组的值的代码(兼容IE与firefox)
- javascript获取checkbox复选框获取选中的选项
- 关于树形菜单 Checkbox的全选
- 利用JavaScript更改input中radio和checkbox样式
- 原生js操作checkbox用document.getElementById实现
- 让checkbox不选中即将选中的checkbox不选中
- jQuery实现checkbox全选的方法
- jquery判断至少有一个checkbox被选中的方法
- jquery无法设置checkbox选中即没有变成选中状态