如何在jstl

时间:2017-05-01 16:39:10

标签: jsp jstl

我是jsp和jstl的新手,这可能不太可能。我需要一种基于订单显示多个货件的方法。在以后的页面中,我希望能够传递一个变量来选择要显示的货件信息。

目前我的变量是这样创建的:

<c:choose>
    <c:when test="${param.order == 1}">
        Param.o_num = <c:out value="${param.order}"/>


        <c:set var="o_buyer" value="Michael S" />
        <c:set var="o_address" value="1234 Frederick St" />
        <c:set var="o_cost" value="$99.98" />
        <c:set var="o_number" value="0000646ASDF" />

        <c:set var="o_shipments" value="3" />

        <c:set var="sh_1_to" value="Colonel Mustard" />
        <c:set var="sh_1_date" value="Wednesday, May 10, 2017" />
        <c:set var="sh_1_address" value="1234 Study Lane" />
        <c:set var="sh_1_city" value="Omaha" />
        <c:set var="sh_1_state" value="NE" />
        <c:set var="sh_1_zip" value="68152" />
        <c:set var="sh_1_num" value="001" />
        <c:set var="sh_1_total" value="$24.99" />
        <c:set var="sh_1_status" value="Preparing Shipment" />
        <c:set var="sh_1_message" value="Its good stuff, please enjoy." />
        <c:set var="sh_1_signature" value="- Michael" />

        <c:set var="sh_2_to" value="Miss Scarlet" />
        <c:set var="sh_2_date" value="Wednesday, April 24, 2017" />
        <c:set var="sh_2_address" value="1234 Library Ave" />
        <c:set var="sh_2_city" value="Omaha" />
        <c:set var="sh_2_state" value="NE" />
        <c:set var="sh_2_zip" value="68102" />
        <c:set var="sh_2_num" value="002" />
        <c:set var="sh_2_total" value="$24.99" />
        <c:set var="sh_2_status" value="Preparing Shipment" />
        <c:set var="sh_2_message" value="Eat Well and Prosper." />
        <c:set var="sh_2_signature" value="- Mike S" />

        <c:set var="sh_3_to" value="Mrs Peacock" />
        <c:set var="sh_3_date" value="Wednesday, April 18, 2017" />
        <c:set var="sh_3_address" value="1234 Kitchen Blvd" />
        <c:set var="sh_3_city" value="Omaha" />
        <c:set var="sh_3_state" value="NE" />
        <c:set var="sh_3_zip" value="68106" />
        <c:set var="sh_3_num" value="003" />
        <c:set var="sh_3_total" value="$24.99" />
        <c:set var="sh_3_status" value="Delivered" />
        <c:set var="sh_3_message" value="Don''t forget to chew." />
        <c:set var="sh_3_signature" value="- Michael S" />



    </c:when>
    <c:when test="${param.order == 2}">...

我可以通过以下方式访问它们:

<c:choose>
    <c:when test="${not empty sh_1_to }">

        <div class="border">
            <a class="os_card <c:out value=" ${sh_1_status= ='Delivered' ? 'os_card_disabled' : '' }" />" title="" href="${shipURL}1">
                <dl class="os_shipment">
                    <dt>Send To</dt>
                    <dd>${sh_1_to}</dd>

                    <dt>Est. Delivery</dt>
                    <dd>${sh_1_date}</dd>

                    <dt>Total</dt>
                    <dd>${sh_1_total}</dd>

                    <dt>Number</dt>
                    <dd>${o_number}-${sh_1_num}</dd>

                    <dt>Status</dt>
                    <dd>${sh_1_status}</dd>

                </dl>
            </a> 
        </div>

    </c:when>
    <c:otherwise>
    </c:otherwise>
</c:choose>

有没有办法让我将其更改为$ {shipment.to},其中包含&#39; shipping&#39;是变量吗?

0 个答案:

没有答案