vendredi 23 juin 2017

JSP dynamic table with one input box and one checkbox in each row

I am now designing .jsp that contains a dynamic table which the data will be retrieved from datasource (which doesn't matter). The requirement is same with my topic. And I have complete part of my code but failed to get the user input value.

My code is as below:

<form id="select" method="post" action="select">
<h2 style="text-align: center;">Plan List</h2>
<p style="width: 100%; text-align: center;">
    <button type="submit"
        >Select</button>
</p>
<table class="details">
    <tr class="details">
        <th class="details" style="text-align: center;">Plan Name</th>
        <th class="details" style="text-align: center;">Quota</th>
    </tr>
    <c:forEach items="${list}" var="plan">
        <tr class="details">
            <td class="details" style="text-align: center;">${plan.planName}</td>
            <td class="details" style="text-align: center;"><input
                type="text" name="quota2" min="1"></td>
            <td class="details"><input type="checkbox" name="selection2"
                value="${selectedPartnerId},${plan.planId}" /></td>
        </tr>
    </c:forEach>

</table>

The design is to select the rows by clicking the checkboxs, then click the select button to submit the selected rows. I am now able to pass the data by putting the variable to value. However, I cannot find any way to pass the value that belonged to user's input. I have already spent two days for this. Please give me some advice. Thanks a lot for your precious time....




Aucun commentaire:

Enregistrer un commentaire