【问题标题】:How can i export the values into the Export to Excel using the 'source' attribute?如何使用“源”属性将值导出到“导出到 Excel”中?
【发布时间】:2012-10-26 05:23:48
【问题描述】:

我们正在使用 servlet 导出到 excel,servlet 名称为“MultiTableExportServlet”。我们需要为servlet 传递三个参数,即'multitablesId'、'name'、'type'。 'multitablesId' 名称用于识别使用 jsp 的部分导出到 excel。 “名称”用于标识导出到 excel 的名称。 '类型'应该定义excel然后才填充。 我在不使用装饰器的情况下使用链接。来自 jsp 页面的每个请求我传递两个参数,然后根据参数构建查询并使用查询对象列表使用“源”属性显示结果这 。 我的问题是加载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 时,我需要新的值列表。

【问题讨论】:

    标签: export jstl export-to-excel struts-1 displaytag


    【解决方案1】:
    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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-10
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      • 2010-10-15
      • 2013-07-15
      • 2017-07-12
      • 2017-08-29
      相关资源
      最近更新 更多