Hi everyone...

im new to this forum and also in web application using jsp-jstl.

im having problem passing data from a multilple check box lists.

here's my code:

<form method="post"><sql:query var="charge" dataSource="${datasource}">
                                                            SELECT chargeID, commodity FROM other_charges where charges_typeID = 1
                                                        </sql:query>
                                                            <span class="cell_content">Toiletries:</span><br />
                                                            <c:forEach var="row" items="${charge.rows}">
                                                                <input type="checkbox" name="toiletries" value="${row.commodity}" />${row.commodity}<br />
                                                                <input type="hidden" name="toiletID" value="${row.chargeID}" size="2" />
                                                            </c:forEach>
</form>

<c:if test="${pageContext.request.method=='POST'}">
                                                    <sql:query var="toilet" dataSource="${datasource}">
                                                        SELECT commodity FROM other_charges where chargeID = ${param.toiletID}
                                                    </sql:query>
                                                    <c:forEach var="row" items="${toilet.rows}">
                                                        ${row.commodity}
                                                    </c:forEach>
                                                </c:if>

I used the input text box to hold the id's of each data to pass when i click the submit button but the result appeared of my query after submission is just the first data that has been queried using foreach inside the form tag. need help guys.

problem solved! all I needed was, to use paramValues. argh!

here's the code:

<c:forEach var="row" items="${paramValues.toiletries}">
${row}<br />
</c:forEach>

I have the same problem, but your solution didn't work

Here is my code

<form>
            <table border="1" align="center" valign="center">
                <c:forEach var="row" items="${parcelas.rows}">

                    <form>
                        <td>
                            <input type="checkbox" name="id" value="${row.parcelaID}" >
                        </td>
                    </form>
                    <td><c:out value="${row.parcelaID}"/></td>
                    <td><c:out value="${row.parcelaVencimento}"/></td>
                    <td ><c:out value="${row.parcelaValor}"/></td>
                    <td><c:out value="${row.clienteID}"/></td>

                    <tr></tr>


                </c:forEach>

            </table>
  <input type="submit" value="OK" />

        </form>



<c:forEach var="row" items="${param.id}">
    <c:out value="${row}"/><br/>
</c:forEach>

Thanks

I worked

But I still lose , what checkbox I checked
Do you know how to maintain them ?
Rgds

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.