多选框模糊
程序员文章站
2022-07-13 23:03:21
...
<form id="f" action="<%=path%>/list.do" method="post">
<input type="hidden" name="page" id="page">
姓名:<input type="text" name="*1" value="${map.*1 }"><br>
部门:<c:forEach items="${dlist }" var="d">
<input type="checkbox" name="dids" value="${d.did }"
<c:forEach items="${map.dids }" var="did">
${did==d.did?'checked':'' }
</c:forEach>
>${d.dname }
</c:forEach>
<input type="submit" value="搜搜">
@RequestMapping("list.do")
public String list(Integer[] dids,String *1,Model model,@RequestParam(value="page",required=true,defaultValue="1")Integer page){
Map map = new HashMap();
map.put("*1", *1);
map.put("dids", dids);
PageHelper.startPage(page,3);
List list = es.list(map);
PageInfo p = new PageInfo(list);
//部门的集合
List dlist = es.dList();
model.addAttribute("list",list);
model.addAttribute("p",p);
model.addAttribute("map",map);
model.addAttribute("dlist",dlist);
return "list";
}
<if test="dids!=null">
and b.did in
<foreach collection="dids" open="(" close=")" separator="," item="did">
#{did}
</foreach>
</if>
上一篇: UI 多选框,跳转。