jeudi 14 juin 2018

How to insert the necessary item in the necessary column jsp?

There was a need to dynamically fill the table according to the data from the database. How correctly to make it in jsp? I tried like this.

<thead>
                    <tr>
                        <td>№</td>
                        <td>Pilot</td>
                        <td>Navigator</td>
                        <td>Radio Operator</td>
                        <td>Stewardess</td>
                    </tr>
                    </thead>
                    <c:set var="k" value="0"/>
                    <c:forEach var="item" items="${pilotList}"> //I address to the list of pilots
                        <c:set var="k" value="${k+1}"/> //To count the table elements
                        <tr>
                            <td><c:out value="${k}"/></td>
                            <td>${item.name}<input class="cb" type="checkbox"  name="itemId" value="${item.id}" onchange="check(this)"/></td> // add into table
                        </tr>
                    </c:forEach>
                </table>

Here I get the elements from the pilotList. I have a navigatorList. I do not know how to correctly add elements from navigatorList to the third column! Can you advise that something? I will be grateful to you




Aucun commentaire:

Enregistrer un commentaire