A different format is displayed in the JSP depending on the condition

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.