fq0808405 2015-08-06 09:25 采纳率: 100%
浏览 1112

Struts2+jasperreports+ireport主报表向子表传List作为数据源报错

问题如题,要导出excel,首先action部分配置如下:

 <action name="deviceListXLS"
            class="com.gloryscience.syntheticAnalysisCopy.action.struts.DeviceCountAction" method="getDeviceList">
            <result name="success" type="jasper">
                <param name="location">/jasperreports/neDeviceCountRptJasper/nelist.jasper</param>
                <param name="dataSource">deviceAllReportList</param>
                <param name="format">XLS</param>
                <param name="contentDisposition">attachment</param>
                <param name="documentName">deviceAllReportList</param>
                <param name="reportParameters">parameters</param>
            </result>
            <interceptor-ref name="modelParamsStack" />
      </action>

传参部分的java如下:

            //设置子报表路径
            parameters = new HashMap<String, String>();
            parameters.put("subRptDir", request.getRealPath("/jasperreports/neDeviceCountRptJasper/")+"\\");
            getRequest().setAttribute("parameters", parameters);

            //增加数据源
            getRequest().setAttribute("deviceAllReportList", deviceAllReportList);

deviceAllReportList的定义如下:

 private List<DeviceAllReport> deviceAllReportList;

DeviceAllReport.java:

 import java.util.List;

public class DeviceAllReport {

    /**
     * 市公司名称
     */
    private String parentConpanyName;

    /**
     * 区域网元类型列表
     */
    private List<DeviceReport> reportList;

    public String getParentConpanyName() {
        return parentConpanyName;
    }


    public void setParentConpanyName(String parentConpanyName) {
        this.parentConpanyName = parentConpanyName;
    }

    public List<DeviceReport> getReportList() {
        return reportList;
    }

    public void setReportList(List<DeviceReport> reportList) {
        this.reportList = reportList;
    }

}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试