第一行没有添加表单标记

时间:2016-01-04 13:44:07

标签: javascript html jsp

我的html页面的第一行没有添加表单标记。

JSP代码:

   <table style="border-collapse: collapse;" border="1">
    <tr bgcolor="lightblue">

        <th>Mens Cloth</th>
        <th>Womens Cloth</th>
        <th>Others</th>
        <th>Total Clothes</th>
        <th>Status</th>
        <th>User Details</th>
        <th>Submit</th>

    </tr>


    <%-- <c:forEach var="order" items="${orderedList}">
        <div></div>
    </c:forEach> --%>
    <c:if test="${empty orderedList}">
        <tr>
            <td colspan="4">No Results found</td>
        </tr>
    </c:if>
    <c:if test="${! empty orderedList}">
        <c:forEach var="order" items="${orderedList}">
            <form:form method="post" action="updateStatus"
                    commandName="washingOrder">

            <tr>


                    <form:hidden path="orderNo" value="${order.orderNo}" />
                    <td><c:out value="${order}"></c:out></td>
                    <td><c:out value="${order.mensCloth}"></c:out></td>
                    <td><c:out value="${order.womensCloth}"></c:out></td>
                    <td><c:out value="${order.otherClothes}"></c:out></td>


                    <td><c:out value="${order.totalClothes}"></c:out></td>
                    <td><form:select path="orderStatus">
                            <c:forEach items="${orderList}" var="orderList">
                                <option
                                    <c:if test="${orderList.key eq order.orderStatus}">selected</c:if>
                                    value="${orderList.key}">${orderList.value}</option>
                            </c:forEach>
                        </form:select></td>

                    <td><a href="getUserDetails?order_id=${order.orderNo}">UserDetails</a></td>
                    <td><input type="submit" value="Submit"/></td>

            </tr>
     </form:form>
        </c:forEach>
    </c:if>
    </table>

当转换为HTML页面时,第一行会错过表单标记。

                    <input id="orderNo" name="orderNo" value="1" type="hidden">
                    <td>WashingOrder [orderNo=1, totalClothes=9, mensCloth=3, womensCloth=3, Others=3, deliveryDate=2015-01-01 00:09:00.0, orderStatus=Ordered]</td>
                    <td>3</td>
                    <td>3</td>
                    <td>3</td>


                    <td>9</td>
                    <td><select id="orderStatus" name="orderStatus">

                                <option value="PU">Pick-Up</option>

                                <option value="OD">Ordered</option>

                                <option value="WP">Washing Processing</option>

                                <option value="PK">Packing</option>

                                <option value="OTW">On the way</option>

                                <option value="DD">Delivered</option>

                        </select></td>

                    <td><a href="getUserDetails?order_id=1">UserDetails</a></td>
                    <td><input type="submit" value="Submit"></td>

            </tr>

对于剩余的行,它会被添加,我可以处理请求。

我错过了在jsp标签中添加的任何内容?

1 个答案:

答案 0 :(得分:0)

问题的原因可能是您只有<form:form><form:hidden>的开场代码。具有结束标记的<form:select>在HTML中正确呈现。