Summary of Several Problems Encountered in "foreach loop" and several questions about foreach

Source: Internet
Author: User

Summary of Several Problems Encountered in "foreach loop" and several questions about foreach

1. when the list page uses "foreach loop", the data is not displayed. In this case, you need to check whether the first letter of the attribute in your object model is in uppercase. Remember not to use uppercase letters (when I am working on a project, the object model is created by someone else, and the first letter of the attribute is capitalized. As a result, the data on the last list page is not displayed. Later, I asked the teacher to change it to lower-case, which is instantly better ).
2. data cannot be stored in the Table: When the column name of the data table is not specified in the ing file, the column name of the data table must be the same as the attribute name (applied to the hibername operation database ).

3. When using foreach, the data content from other pages to this page is not displayed. In this case, the path to this page must be changed to the access path in the browser on other pages.

1 <table class = "table_style"> 2 <thead> 3 <tr> 4 <th> 5 <input id = "all" type = "checkbox" onclick = "selectAll (); "value =" checkbox "> 6 <label> select all </label> 7 </th> 8 <th> sample number </th> 9 <th> name of the person to be checked </th> 10 <th> ID of the examinee </th> 11 <th> hospital name </th> 12 <th> sample type </th> 13 <th> mobile phone number </th> 14 <th> creation time </th> 15 </tr> 16 </thead> 17 <c: forEach var = "hello" items = "$ {key}" step = "1"> 18 <tr> 19 <td> 20 <input type = "checkbox" value = "$ {hello. iD} "name =" checkbox "> 21 </td> 22 <td> 23 <a href =" javascript: void (0) ">$ {hello. sampleNo} </a> 24 </td> 25 <td >$ {hello. name} </td> 26 <td >$ {hello. pId} </td> 27 <td >$ {hello. hospitalName} </td> 28 <td >$ {hello. sampleType} </td> 29 <td >$ {hello. cellPhone} </td> 30 <td >$ {hello. createTime }</td> 31 </tr> 32 </c: forEach> 33 34 </table>

 

Related Article

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.