Home > Web Front-end > JS Tutorial > body text

Share an example tutorial on foreach loop problem

零下一度
Release: 2017-05-10 11:06:31
Original
1692 people have browsed it

This article mainly introduces a summary of the problems encountered in the foreach loop. It is very good and has a reference. Value, friends who need it can refer to it

1. When using "foreach loop" on the list page, the data is not displayed. At this time, you need to check your ObjectModel中# Whether the first letter of ##attribute is capitalized, remember not to capitalize it (when I was working on a project, the object model was established by someone else, and the first letter of the attribute was capitalized, which caused the data on the final list page not to be displayed. Later, I asked the teacher, It said that it was changed to lowercase and it was cured instantly).

2. The data cannot be stored in the table: When the data table column name is not specified in the mapping file, the data table column name must be the same as the attribute name (applied to the hibername operation database).

3. When using foreach, the data content that jumps from other pages to this page will not be displayed. At this time, the path to jump to this page in other pages must be changed to the access path in the browser.

<table class="table_style">
              <thead>
                <tr>
                  <th>
                      <input id="all" type="checkbox" onclick="selectAll();" value="checkbox"> 
                    <label>全选 </label>
                  </th>
                  <th>样本编号</th>
                  <th>被检者姓名</th>
                  <th>被检者ID</th>
                  <th>医院名称</th>
                  <th>样本类型</th>
                  <th>手机</th>
                  <th>创建时间</th>
                </tr>
              </thead>
              <c:forEach var="hello" items="${key}" step="1" >
                <tr>
                  <td>
                     <input type="checkbox"  value="${hello.iD}" name="checkbox">
                  </td>
                  <td>
                    <a href="javascript:void(0)" rel="external nofollow" >${hello.sampleNo}</a>
                  </td>
                  <td>${hello.name}</td>
                  <td>${hello.pId}</td>
                  <td>${hello.hospitalName}</td>
                  <td>${hello.sampleType}</td>
                  <td>${hello.cellPhone}</td>
                  <td>${hello.createTime}</td>
                </tr> 
              </c:forEach>  
            </table>
Copy after login

【Related recommendations】

1.

Free js online video tutorial

2.

JavaScript Chinese Reference Manual

3.

php.cn Dugu Jiujian (3) - JavaScript video tutorial

The above is the detailed content of Share an example tutorial on foreach loop problem. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template