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>