0

我们使用 servlet 导出到 excel,servlet 名称为“MultiTableExportServlet”。我们需要为servlet 传递三个参数,即'multitablesId'、'name'、'type'。'multitablesId' 名称用于识别使用 jsp 的部分导出到 excel。“名称”用于标识导出到 excel 的名称。'类型'应该定义excel然后才填充。我在不使用装饰器的情况下使用链接。来自jsp页面的每个请求我传递两个参数,然后根据参数我构建查询并使用查询对象列表显示结果,使用'Source'属性这 。我的问题是加载jsp页面后。然后我点击'href' 使用它执行一些业务逻辑的链接并将其存储到查询对象列表中并填充到导出中以正确处理我想要的任何内容。但是,如果我第二次单击“href”链接,它不会更改列表值。所以我每次都清除列表。但它在 excel 中显示了 emty QO 列表。在这里,我粘贴了我的示例代码以供您关注。

jsp页面:

<display:table name="${weeklyDlvyInstancesDashboardReportForm.asnAccuracyListQO}" uid="asnAccuracyListUID" sort="list" defaultsort="1" 
                                        requestURI="/weeklyDlvyInstancesDashboardReportPre.do?method=httpGet" excludedParams="method"
                                        decorator="com.ford.mpl.superg.decorator.WeeklyDeliveryInstancesTypeTableDecorator" keepStatus="true">
                                        <%@include file="/jsp/include/displaytag.jsp"%>
                                        <c:set value="${asnAccuracyListUID.firstWeekOfCountLabel}" var="asnAccuracyFirstWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.secondWeekOfCountLabel}" var="asnAccuracySecondWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.thirdWeekOfCountLabel}" var="asnAccuracyThirdWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.fourthWeekOfCountLabel}" var="asnAccuracyFourthWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.fifthWeekOfCountLabel}" var="asnAccuracyFifthWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.sixthWeekOfCountLabel}" var="asnAccuracySixthWeekOfCount"/>

                                        <c:choose>
                                        <c:when test="${asnAccuracyListUID.instanceTypeDescription != null && asnAccuracyListUID.instanceTypeDescription != 'Sum'}">
                                            <display:column property="instanceTypeDescription" title="Instance Type" sortable="false"/>
                                        </c:when>
                                        <c:otherwise>
                                            <display:column property="instanceTypeDescription" title="Instance Type" sortable="false" style="font-weight:bold;text-align:center"/>
                                        </c:otherwise>
                                        </c:choose>


                                        <display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" href="${pageContext.request.contextPath }/weeklyDlvyInstancesDashboardReportPost.do?method=WeeklyDlvyInstExcelReport&ratingElementIdFromJSP=${asnAccuracyListUID.ratingElementId}" paramProperty="instanceType" paramId="instanceTypeFromJSP" sortable="false"/>
                                        <display:column property="secondWeekOfCount" title="${asnAccuracySecondWeekOfCount}" sortable="false"  />
                                        <display:column property="thirdWeekOfCount" title="${asnAccuracyThirdWeekOfCount}" sortable="false"  />
                                        <display:column property="fourthWeekOfCount" title="${asnAccuracyFourthWeekOfCount}" sortable="false" />
                                        <display:column property="fifthWeekOfCount" title="${asnAccuracyFifthWeekOfCount}" sortable="false" />
                                        <display:column property="sixthWeekOfCount" title="${asnAccuracySixthWeekOfCount}" sortable="false"/>
                                    </display:table>
                                </fieldset>

                                    <export:multitables id="nameid">
                                        <export:table title="tablename" source="${weeklyDlvyInstancesDashboardReportForm.asnAccuracyInstancesRatingElementQO}">
                                            <export:column property="shipCode" title="Ship Code" />
                                            <export:column property="plantOrRecLoc" title="Plant/Rec Loc" />
                                            <export:column property="instanceType" title="Instance Type" />
                                            <export:column property="fordOrg" title="Ford Org" />
                                            <export:column property="OrgType" title="Org Type" />
                                            <export:column property="region" title="Region" />
                                            <export:column property="shipDate" title="Ship Date" />
                                            <export:column property="errorTransmitted" title="Error Transmitted" />
                                            <export:column property="externalAlertNo" title="External Alert Number" />
                                            <export:column property="asnNumber" title="ASN Number"/>
                                            <export:column property="packingSlipNumber" title="Packing Slip Number"/>
                                        </export:table>
                                    </export:multitables>

Struts-config.xml:

<action path="/weeklyDlvyInstancesDashboardReportPost"
            type="*.*.*.*.action.*.*Action"
            name="weeklyDlvyInstancesDashboardReportForm" scope="session" validate="false"
            parameter="method">
            <forward name="httpGet" path="tile.showreport"></forward>
            <forward redirect="true" name="somname" path="/MultiTableExportServlet?multitablesId=nameid&amp;name=exporttoexcel&amp;type=excel"></forward>
        </action>

我需要的是当我从 jsp 页面单击 href 时我想要新的值列表。

4

1 回答 1

0
using the decorator in the <export:table> i solved my issue.

    <export:multitables id="WeeklyDeliveryInstances-Count" >
                                            <export:table title="tablename" source="${weeklyDlvyInstancesDashboardReportForm.weeklyDeliveryInstancesRatingElementQO}"
decorator="com.ford.mpl.superg.decorator.WeeklyDeliveryInstancesTypeTableDecorator">
                                                <export:column property="shipCode" title="Ship Code" />
                                                <export:column property="plantOrRecLoc" title="Plant/Rec Loc" />
                                                <export:column property="instanceType" title="Instance Type" />
                                                <export:column property="fordOrg" title="Ford Org"/>
                                                <export:column property="orgType" title="Org Type" />
                                                <export:column property="region" title="Region" />
                                                <export:column property="conveyanceDepartureDateAndTime" title="Conveyance Departure Date And Time"/>
                                                <export:column property="asnReceivedDateAndTime" title="ASN Recieved Date And Time" />
                                                <export:column property="externalAlertNo" title="External Alert No" />
                                                <export:column property="asnNumber" title="ASN Number" />
                                                <export:column property="packingSlipNumber" title="Packing Slip Number" />
                                                <export:column property="timeDeviance" title="Time Deviance(hh:mm)" />
                                            </export:table>
于 2012-11-01T15:24:10.120 回答