The value of the map is taken out of the JSP and a check box is generated based on the key value;
The package to use
<%@ Page Import="Com.hebrf.dbmanage.DBManage"%><%@ Page Import="com.hebrf.dbmanage.DBFactory"%><%@page Import="java.util.List"%><%@page Import="Java.util.Map"%><%@ taglib Prefix="C"URI="Http://java.sun.com/jsp/jstl/core" %>
Find a map by database
Dbmanage db = Dbfactory.getdbmanage (); List lis = Db.getlistbymap ("Select DM as DM,MC as MC from zdcdzllx"); Request.setattribute ("Lis", Lis);
Get the collection ([{mc= written material, dm=01}, {mc= picture material, dm=02}, {mc= print material, dm=03}, {mc= av material, dm=04}, {mc= check-in table, dm=05}, {mc= other materials, dm=06}]
Loop build check box
<TDcolspan= "3"> <C:foreachItems= "${lis}"var= "L"> <inputtype= "checkbox"name= "Dazllx"value= "${l.dm}"ID= "dazllx${l.dm}" /> <label for= "dazllx${l.dm}">${L.MC}</label> </C:foreach> </TD>
The resulting effect
written MaterialsPicture MaterialPrinting MaterialsAV materialRegistration FormOther materials
JSP foreach Fetch map