One, no duplicate record added
1. addexpressprice.jsp (show list of provinces in list)
<td> <div class= "Controls" ><form:select path= "Provinceid" > <form:options items= "${provincelist } "itemlabel=" label "itemvalue=" value "/> </form:select> </div></td>
2. Expresspricecontroller.java (Initialize page)
@RequestMapping (value = "Initaddexpressprice", method = requestmethod.get) public String Initaddexpressprice (Model mode L, Expresspriceform expresspriceform) {log.info ("The price of the additional courier is initialized"); list<item> provincelist = Itemlistcomponent.getprovincelist1 (Expresspriceform.getexpressid ()); Model.addattribute ("Provincelist", provincelist); Model.addattribute ("Expresspriceform", expresspriceform); return "Manager/expressprice/addexpressprice"; }
3, Itemlistcomponent.java
Public list<item> GetProvinceList1 (String expressid) {return querydao.executeforobjectlist ("common.selectexpr Esspriceprovince ", Expressid);}
4, Commonsqlmap.xml
<select id= "selectexpresspriceprovince" parameterclass= "java.lang.String" resultclass= " Cn.agriculture.web.form.Item ">select Province_name as label,province_id as Valuefrom province WHERE not exists (Selec T express_price.province_idfrom express_price,expresswhere express_price.province_id=province.province_id A ND express.express_id=express_price.express_id and express.express_id= #value #) </select>
Second, the provinces are displayed in list form
1,addexpressprice.jsp
<form:select path= "Provinceid" ><form:options items= "${provincelist}" itemlabel= "label" itemValue= "value"/ ></form:select>
2, Itemlistcomponent.java
Public list<item> getprovincelist () {return querydao.executeforobjectlist ("common.selectprovince", null);} public string Getprovincelabel (string provincevalue) {return querydao.executeforobject ("Common.selectprovincelabel" , Provincevalue, String.class);}
3,Commonsqlmap.xml
<select id= "selectprovince" resultclass= "Cn.agriculture.web.form.Item" >select Province_name as Label,province _id as Valuefrom province</select><select id= "Selectprovincelabel" parameterclass= "java.lang.String" resultclass= "Java.lang.String" >select province_name as Labelfrom provincewhere province_id = #value #</select >
8-11 no existing record when adding courier price