0

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.

Edited by jet101: n/a

2
Contributors
4
Replies
7
Views
7 Years
Discussion Span
Last Post by Watashi
0

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>

0

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>

Edited by Dani: Formatting fixed

0

Thanks

I worked

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.