This scenario is encountered in the project:
When you query to a record, you need to use the field of the record as a drop-down list, which allows the user to select a drop-down list to display.
When a record is not queried, the user is asked to fill out the value manually, which is the text box displayed.
The previous JSP uses the IF tag as follows:
<c:if test= "${requestscope.listsize==0}" ><td>
<input type= "text" name= "Erpptcode" value= "${productconfig.erpptcode}" style= "width:180px;" required= " Required "/></TD></C:if><c:ifclass=" Easyui-validatebox "Name=" Erpptcode "required=" required "> <option value=" ">-Please select-</option> <c:foreach var=" op "items=" ${ Productconfiglist} "> <option value=" ${op.id} "= = Op.erpptcode? ' Selected ': '}>${op.erpptcode}</option> </c:forEach> </select></td></c:if >
The background Java program passes parameters as follows:
int listsize = 0= "from Tproductconfig where" + "Shopaccesstokensid = '" + Tokenid + "'" + " and Ecitem = ' "+ Ecitem +" ' "; List<TProductConfig> productconfiglist == productconfiglist.size (); Model.addattribute ( "Productconfiglist", productconfiglist); Model.addattribute ("Listsize", listsize);
The final results are as follows:
1. There are query records show
2. No query record shows:
A different format is displayed in the JSP depending on the condition