posts - 310, comments - 6939, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

整合Struts2+JasperReport Web报表应用示例

Posted on 2008-01-02 22:20 诗特林 阅读(26632) 评论(168)  编辑  收藏 所属分类: BI
 

整合Struts2+JasperReport Web报表应用示例

 

JasperReports作为一种优秀且开源的报表引擎,不利用太可惜了。同时,借助开源的JasperReports模板设计利器iReports,可以可视化的设计报表模板。基于Web的报表在很多项目中都是需要的。而随着Struts2的流行,就应该研究一下在Struts2下如何利用JasperReports进行报表输出。本示例比较简单,采用的数据源即为JavaBean,而没有采用复杂的数据库,其实原理是一样的。只是传递给JasperReports的参数随着连接方式的变化而略加修改而已。

准备工作

所使用的类库及Jar包如下图所示:


1.使用的Jar

开发环境:MyEclipse5.5+Eclipse3.2+JDK5.0+Tomcat5.5+Struts 2.0.6。当然,本该所提供的源代码下载中没有提供相关的lib,因为文件大太,如果需要,请留下email

源代码下载:Struts2AndJasperReport.rar

设计报表模板

本例中采用JavaBean作为数据源,用于显示People对象的一些基本属性,如所在序号、城市、姓名、地址,并对同一城市的人员进行汇总小结显示。

至于如何在iReports中设计模板文件,请在网上参考其它文档。这里不再详细解读,或有时间俺再另写文章来具体讲解如何在iReports中设计报表模板。WebRoot\jasper\jasper_template.jrxml代码如下:

<?xml version="1.0" encoding="UTF-8"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
         
name="jasper_template"
         columnCount
="1"
         printOrder
="Vertical"
         orientation
="Portrait"
         pageWidth
="595"
         pageHeight
="842"
         columnWidth
="535"
         columnSpacing
="0"
         leftMargin
="30"
         rightMargin
="30"
         topMargin
="20"
         bottomMargin
="20"
         whenNoDataType
="NoPages"
         isTitleNewPage
="false"
         isSummaryNewPage
="false">
    
<property name="ireport.scriptlethandling" value="0" />
    
<property name="ireport.encoding" value="UTF-8" />
    
<import value="java.util.*" />
    
<import value="net.sf.jasperreports.engine.*" />
    
<import value="net.sf.jasperreports.engine.data.*" />

    
<parameter name="rptMan" isForPrompting="false" class="java.lang.String">
        
<defaultValueExpression ><![CDATA["sterning"]]></defaultValueExpression>
    
</parameter>
    
<parameter name="rptDate" isForPrompting="false" class="java.lang.String">
        
<defaultValueExpression ><![CDATA["2008-01-12"]]></defaultValueExpression>
    
</parameter>

    
<field name="city" class="java.lang.String">
        
<fieldDescription><![CDATA[city]]></fieldDescription>
    
</field>
    
<field name="street" class="java.lang.String">
        
<fieldDescription><![CDATA[street]]></fieldDescription>
    
</field>
    
<field name="id" class="java.lang.Integer">
        
<fieldDescription><![CDATA[id]]></fieldDescription>
    
</field>
    
<field name="name" class="java.lang.String">
        
<fieldDescription><![CDATA[name]]></fieldDescription>
    
</field>

    
<variable name="CityNumber" class="java.lang.Integer" resetType="Group" resetGroup="CityGroup" calculation="Sum">
        
<initialValueExpression><![CDATA[($V{CityNumber} != null)?(new Integer($V{CityNumber}.intValue() + 1)):(new Integer(1))]]></initialValueExpression>
    
</variable>
    
<variable name="AllCity" class="java.lang.Integer" resetType="Report" calculation="Sum">
        
<initialValueExpression><![CDATA[($V{AllCity} != null)?(new Integer($V{AllCity}.intValue() + 1)):(new Integer(1))]]></initialValueExpression>
    
</variable>

        
<group  name="CityGroup" >
            
<groupExpression><![CDATA[$F{city}]]></groupExpression>
            
<groupHeader>
            
<band height="0"  isSplitAllowed="true" >
            
</band>
            
</groupHeader>
            
<groupFooter>
            
<band height="37"  isSplitAllowed="true" >
                
<staticText>
                    
<reportElement
                        
x="98"
                        y
="5"
                        width
="51"
                        height
="25"
                        key
="staticText-8"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="14" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<text><![CDATA[灏忚锛歖]></text>
                </staticText>
                <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="149"
                        y="5"
                        width="34"
                        height="25"
                        key="textField-7"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="14" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    </textElement>
                <textFieldExpression   class="java.lang.Integer"><![CDATA[$V{CityGroup_COUNT}
]]></textFieldExpression>
                
</textField>
                
<line direction="TopDown">
                    
<reportElement
                        
x="-30"
                        y
="36"
                        width
="593"
                        height
="0"
                        key
="line-5"/>
                    
<graphicElement stretchType="NoStretch"/>
                
</line>
            
</band>
            
</groupFooter>
        
</group>
        
<background>
            
<band height="0"  isSplitAllowed="true" >
            
</band>
        
</background>
        
<title>
            
<band height="62"  isSplitAllowed="true" >
                
<staticText>
                    
<reportElement
                        
x="20"
                        y
="0"
                        width
="484"
                        height
="57"
                        forecolor
="#FF0033"
                        key
="staticText-1"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement textAlignment="Center">
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="36" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<text><![CDATA[Struts2+JasperReports绀轰緥]]></text>
                
</staticText>
                
<line direction="TopDown">
                    
<reportElement
                        
x="-30"
                        y
="61"
                        width
="594"
                        height
="0"
                        key
="line-4"/>
                    
<graphicElement stretchType="NoStretch"/>
                
</line>
            
</band>
        
</title>
        
<pageHeader>
            
<band height="13"  isSplitAllowed="true" >
                
<line direction="TopDown">
                    
<reportElement
                        
x="-29"
                        y
="12"
                        width
="592"
                        height
="0"
                        key
="line-3"/>
                    
<graphicElement stretchType="NoStretch"/>
                
</line>
            
</band>
        
</pageHeader>
        
<columnHeader>
            
<band height="45"  isSplitAllowed="true" >
                
<staticText>
                    
<reportElement
                        
x="13"
                        y
="5"
                        width
="62"
                        height
="33"
                        key
="staticText-2"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="24" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<text><![CDATA[搴忓彿]]></text>
                
</staticText>
                
<staticText>
                    
<reportElement
                        
x="98"
                        y
="5"
                        width
="62"
                        height
="33"
                        key
="staticText-3"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="24" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<text><![CDATA[鍩庡競]]></text>
                
</staticText>
                
<staticText>
                    
<reportElement
                        
x="212"
                        y
="5"
                        width
="62"
                        height
="33"
                        key
="staticText-4"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="24" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<text><![CDATA[濮撳悕]]></text>
                
</staticText>
                
<staticText>
                    
<reportElement
                        
x="331"
                        y
="5"
                        width
="62"
                        height
="33"
                        key
="staticText-5"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="24" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<text><![CDATA[浣忓潃]]></text>
                
</staticText>
                
<line direction="TopDown">
                    
<reportElement
                        
x="-30"
                        y
="43"
                        width
="596"
                        height
="0"
                        key
="line-2"/>
                    
<graphicElement stretchType="NoStretch"/>
                
</line>
            
</band>
        
</columnHeader>
        
<detail>
            
<band height="43"  isSplitAllowed="true" >
                
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    
<reportElement
                        
x="13"
                        y
="7"
                        width
="62"
                        height
="30"
                        key
="textField-1"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="14" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<textFieldExpression   class="java.lang.Integer"><![CDATA[$F{id}]]></textFieldExpression>
                
</textField>
                
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    
<reportElement
                        
x="98"
                        y
="7"
                        width
="105"
                        height
="29"
                        key
="textField-2"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="14" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<textFieldExpression   class="java.lang.String"><![CDATA[$F{city}]]></textFieldExpression>
                
</textField>
                
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    
<reportElement
                        
x="212"
                        y
="8"
                        width
="100"
                        height
="28"
                        key
="textField-3"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="14" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<textFieldExpression   class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
                
</textField>
                
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    
<reportElement
                        
x="331"
                        y
="7"
                        width
="111"
                        height
="30"
                        key
="textField-4"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="14" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<textFieldExpression   class="java.lang.String"><![CDATA[$F{street}]]></textFieldExpression>
                
</textField>
                
<line direction="TopDown">
                    
<reportElement
                        
x="-30"
                        y
="37"
                        width
="593"
                        height
="0"
                        key
="line-1"/>
                    
<graphicElement stretchType="NoStretch"/>
                
</line>
            
</band>
        
</detail>
        
<columnFooter>
            
<band height="37"  isSplitAllowed="true" >
            
</band>
        
</columnFooter>
        
<pageFooter>
            
<band height="50"  isSplitAllowed="true" >
                
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    
<reportElement
                        
x="98"
                        y
="18"
                        width
="138"
                        height
="23"
                        key
="textField-8"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement textAlignment="Right">
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="12" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<textFieldExpression   class="java.lang.String"><![CDATA["椤垫暟 " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
                
</textField>
                
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None"  hyperlinkTarget="Self" >
                    
<reportElement
                        
x="239"
                        y
="18"
                        width
="83"
                        height
="23"
                        key
="textField-9"/>
                    
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    
<textElement>
                        
<font fontName="瀹嬩綋" pdfFontName="STSong-Light" size="12" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
                    
</textElement>
                
<textFieldExpression   class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
                
</textField>
            
</band>
        
</pageFooter>
        
<lastPageFooter>
            
<band height="50"  isSplitAllowed="true" >
            
</band>
        
</lastPageFooter>
        
<summary>
            
<band height="0"  isSplitAllowed="true" >
            
</band>
        
</summary>
</jasperReport>
 

这里需要说明的是,由于俺们中国的中文比较特殊,由此在PDF中显示的时候,需要一些额外的Jar包字体来支持。因此需要下载iTextAsian.jar包,此包专门用于显示亚洲的字符。

 

设计JavaBean

 

由本例中没有使用数据库,而是使用JavaBean作为JRDataSource,来传递给JasperReports作为数据源,因此只需要设计JavaBean\src\com\sterning\PeopleBean.java的代码很简单,只在字个字段:cityidnamestreet,代码如下所示:

package com.sterning;

public class PeopleBean
{
    
private String city = null;
    
private Integer id = null;
    
private String name = null;
    
private String street = null;

    
public PeopleBean(
        String pcity,
        Integer pid,
        String pname,
        String pstreet
        )
    
{
        city 
= pcity;
        id 
= pid;
        name 
= pname;
        street 
= pstreet;
    }


    
public PeopleBean getMe()
    
{
        
return this;
    }


    
public String getCity()
    
{
        
return city;
    }


    
public Integer getId()
    
{
        
return id;
    }


    
public String getName()
    
{
        
return name;
    }


    
public String getStreet()
    
{
        
return street;
    }

}


 

编译模板

其实表面上说是填充数据,其实就是填充一个List。具体的工具都是交给我们的JasperReports去完成。JasperReports要完成数据的填充工作,要经历将编译(将模板文件.jrxml编译成.jasper文件)、加载(加载.jasper文件)、填充(从数据源中取得数据并填充到.jasper二进制文件中)三大步骤。src\com\sterning\JasperAction.java,其代码如下所示:

package com.sterning;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import net.sf.jasperreports.engine.JasperCompileManager;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class JasperAction extends ActionSupport {
    
private static final long serialVersionUID = 1L;

    
private List<PeopleBean> myList;

    
public String execute() throws Exception {
        
//添加数据
        PeopleBean p1=new PeopleBean("长沙"new Integer(9), "李化""天洒路");
        PeopleBean p2
=new PeopleBean("长沙"new Integer(22), "王小样""呆小路564");
        PeopleBean p3
=new PeopleBean("南昌"new Integer(23), "王奸可""小顺路");
        PeopleBean p4
=new PeopleBean("南昌"new Integer(32), "李洒""顺濉路");
        PeopleBean p5
=new PeopleBean("武汉"new Integer(39), "张中尖""天洒路");
        PeopleBean p6
=new PeopleBean("武汉"new Integer(35), "陈主宁""天河路564");
        myList 
= new ArrayList<PeopleBean>();
        myList.add(p1);
        myList.add(p2);
        myList.add(p3);
        myList.add(p4);
        myList.add(p5);
        myList.add(p6);

        
try {
            String reportSource;
            reportSource 
= ServletActionContext.getServletContext()
                    .getRealPath(
"/jasper/jasper_template.jrxml");
            File parent 
= new File(reportSource).getParentFile();
            
//将.jrxml模板文件编译成为.jasper文件,当然,其文件名可以指定,如果没指定,则与.jrxml文件名一样.只是后缀不同而已
            JasperCompileManager.compileReportToFile(reportSource, new File(
                    parent, 
"compiled_jasper_template.jasper")
                    .getAbsolutePath());
        }
 catch (Exception e) {
            e.printStackTrace();
            
return ERROR;
        }

        
return SUCCESS;
    }


    
public List getMyList() {
        
return myList;
    }

}


 

配置Struts2文件

前面这些工作都是为JasperReports而作的。接下来就是将JasperReports集成到Struts2中。

1.  Web.xml

首先是Web.xml。这个文件配置比较简单,也比较常规,没什么好说,代码如下WebRoot\WEB-INF\web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation
="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>
    
<filter>
        
<filter-name>struts2</filter-name>
        
<filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        
</filter-class>
        
<init-param>
            
<param-name>config</param-name>
            
<param-value>
                struts-default.xml,struts-plugin.xml,struts.xml
            
</param-value>
        
</init-param>
    
</filter>
    
<filter-mapping>
        
<filter-name>struts2</filter-name>
        
<url-pattern>/*</url-pattern>
    
</filter-mapping>

    
<!-- The Welcome File List -->
    
<welcome-file-list>
        
<welcome-file>index.jsp</welcome-file>
    
</welcome-file-list>
</web-app>

 

2.  struts.xml

按理说struts.xml配置文件应该更加简单,但这里由于集成了JasperReports,所以看上去要复杂一点。先来看代码:src\ struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"
>
<struts>
    
<package name="default"
        extends
="struts-default,jasperreports-default">
        
<action name="PDF" class="com.sterning.JasperAction">
            
<result name="success" type="jasper">
                
<param name="location">
                    /jasper/compiled_jasper_template.jasper
                
</param>
                
<param name="dataSource">myList</param>
                
<param name="format">PDF</param>
            
</result>
        
</action>
        
<action name="HTML" class="com.sterning.JasperAction">
            
<result name="success" type="jasper">
                
<param name="location">
                    /jasper/compiled_jasper_template.jasper
                
</param>
                
<param name="dataSource">myList</param>
                
<param name="format">HTML</param>
            
</result>
        
</action>
        
<action name="XML" class="com.sterning.JasperAction">
            
<result name="success" type="jasper">
                
<param name="location">
                    /jasper/compiled_jasper_template.jasper
                
</param>
                
<param name="dataSource">myList</param>
                
<param name="format">XML</param>
            
</result>
        
</action>
        
<action name="CSV" class="com.sterning.JasperAction">
            
<result name="success" type="jasper">
                
<param name="location">
                    /jasper/compiled_jasper_template.jasper
                
</param>
                
<param name="dataSource">myList</param>
                
<param name="format">CSV</param>
            
</result>
        
</action>
        
<action name="XLS" class="com.sterning.JasperAction">
            
<result name="success" type="jasper">
                
<param name="location">
                    /jasper/compiled_jasper_template.jasper
                
</param>
                
<param name="dataSource">myList</param>
                
<param name="format">XLS</param>
            
</result>
        
</action>
    
</package>
</struts>
 

这里,当调用JasperActionexecute()方法成功后,返回后,可见有三个参数:location告诉JasperReports数据填充类二进制的.jasper文件的位置,dataSource指明使用什么数据源,format指明报表输出的格式。


 

页面文件

Index.jsp的代码非常的简单,如下:

<%@ page language="java" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    
<head>
        
<title>Struts2+ JasperReports 使用示例</title>
    
</head>
    
<body>
        
<href="HTML.action">HTML</a>
        
<br>
        
<href="PDF.action">PDF</a>
        
<br>
        
<href="XML.action">XML</a>
        
<br>
        
<href="CSV.action">CSV</a>
        
<br>
        
<href="XLS.action">XLS</a>
    
</body>
</html>

 

运行效果

1HTML格式

2.HTML格式

2PDF格式


3.PDF格式

3XML格式


4.XML格式

4Excel格式


5.Excel格式

评论共2页: 上一页 1 2 

评论

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-02 23:50 by ahanflw
能否发一份完整的源码包给我?谢谢 Email:ahanflw@gmail.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-05 15:40 by wangleijava
可以在程序中动态指定报表sql吗??
用ireport的一般都是写死的。

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-05 20:34 by moonzhao
to: wangleijava
数据源可以使用javabean啊
这样,你通过各种条件选择之后,获得一个list,
就可以显示出来了

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-07 21:28 by
非常感谢 可以把源码给我一份吗

66247836@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-11 10:38 by moveriver
可以发给我一份吗,非常感谢!
nan8278@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-22 14:09 by laoniu325
能否给我一份,非常感谢
laoniu325@yahoo.com.cn

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-25 12:39 by nesta
bh_nesta@126.com 感谢!!!

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-28 12:45 by 刘梅
非常感谢 可以把源码给我一份吗
liumei-aa@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-01-28 12:50 by 刘梅
把你所用的包发给我一份,非常感谢!
liumei-aa@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-03-19 13:50 by 吴海亮
麻烦你把你所用的包发给我一份,十分感谢!
hailiang-mail@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-04-18 11:57 by jasonlee1105@hotmail.com
我也要,楼主辛苦 jasonlee1105@hotmail.com
谢谢了

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-04-18 18:03 by lanhongbo
发一份 辛苦了楼主

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-04-18 18:05 by lanhongbo
忘了邮箱 lanhb@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-04-23 10:51 by 于翔
试了好几个别人发布的代码,就楼主的能跑,而且思路清晰,太感谢了。希望能再讲的详细一点,比如dataSource等,你是从List里拿的数据,那要是从数据库里拿呢,怎么定义呢。

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-04-25 09:03 by guidefly
麻烦你把你所用的包发给我一份,十分感谢!
guidefly@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-05-09 09:27 by chair
你的例子很好,多谢,能否将源码发给我一份,谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-05-22 11:47 by onebug
麻烦楼主把包都发我一份。。。万分感激。。
onebug@live.cn

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2008-05-23 17:28 by sky
你好楼主麻烦你能否给我也发一次实例的代码,先谢谢了
ghl0618@163.com

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2008-05-25 15:25 by ak
你好,楼主麻烦你能否给我也发一次实例的代码,先谢谢了.
akyaotaizong@yahoo.com.cn

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2008-05-27 10:30 by joe
非常感谢 可以把源码给我一份吗
joe.chu@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-06-03 11:00 by 一米
辛苦楼主了,给我发一份吧!谢谢!dengshengyx@sina.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-06-08 16:09 by wang
非常感谢您, 可以把源码给我一份吗
email: wangjian3q@163.com

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2008-06-14 12:33 by ivan
如果从ireport中生成的jrxml档是需要连接mysql的, 那麽struts.xml 文件中的datasource 应如何设置呢?

我试过以下方法, 但不成功.

<action name="myJasperTest" class="com.neosales.JasperAction">
<result name="success" type="jasper">
<param name="location">/jasper/stockrpt.jasper</param>
<param name="dataSource">jdbc:mysql://localhost/salesdb?username=xxx&password=yyy</param>
<param name="format">PDF</param>
</result>
</action>


结果是...
Data source value for data source jdbc:mysql://localhost/salesdb?username=xxx&password=yyy was null

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-06-18 20:54 by renjia
请给我一份renjia1028@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-06-19 18:11 by duxiaoyu
请楼主发给我一份!
小弟急用!
非常感谢:anondxy@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-06-26 13:26 by carrie
好文章,可否发一份lib,万分感激 snowrain1999@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-02 12:18 by
yzg000123@sina.com
谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-02 17:11 by wanxinge
麻烦楼主发一份给我,谢谢。邮箱:wangxinge_5689@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-03 14:29 by e.e
谢谢,能否发给我一份原码,将十分感谢!liqiue@gmail.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-05 10:25 by lnsprite
能否发我一份源码吗?nli@sy-toshiba.com.不盛感激,

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-05 16:00 by yaoyun
谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-08 16:05 by 刘辉
楼主 发一份Struts2+JasperReport Web报表应用示例 给我吧 现在项目正急用 210liuhui@163.com 将不胜感激啊

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-22 11:28 by jiayueshan
能否发我一份源码吗?liusha_17@126.com.不盛感激,

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-07-29 16:39 by huxin
能否发我一份源码吗 hu_xin@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-08-02 13:21 by 郭子
你好!我的程序怎么在编译 .jrxml文件那句报异常 :


java.lang.reflect.InvocationTargetException


不知道什么原因!谢谢!

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-08-05 15:38 by 时一郎
我想用一下,发我一份lib吧,谢谢!!
我的邮箱是shirui_0210@yahoo.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-08-22 10:32 by sshzhangwg
很想学习一下,请楼主发给我一份代码,谢谢了,(*^__^*)

邮箱是: sshzhangwg@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-08-25 12:41 by castte
试了一下,导出的excel格式是相当的恶心啊,数不清的行行列列,估计要把模板文件画的很对齐才行。。

pdf还可以,其它没试过

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-08-28 17:39 by locaful
楼主,请发一份代码给我,谢谢,不甚感激。。。locaful@163.com

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2008-08-29 14:07 by report
楼主能给我发一份吗 学习中 谢谢
hyl_1234@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-09-05 11:07 by kevin_gzhz
楼主,有没有struts2与jasperReport结合的开发子报表的例子啊?在struts2的那个地方将集合类型的参数传递给子报表啦,如有相关代码,请发一份给小弟,baiding82@yahoo.com.cn,再次感谢!

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-09-12 22:40 by xcp
很好,很强大,楼主给我发一份源码!!!
xcp__long@126.com
谢谢!!!!

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-09-16 17:55 by xay
可否发份完整代码
Email:xanyuan@gmail.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-09-22 11:34 by 各个
可否发一份给我..谢谢..急用...弄了一天了..郁闷 邮箱:wbeibei121@sina.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-09-25 13:34 by dingdang
可否发一份给我..谢谢..急用 邮箱:250802992@qq.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-09-26 17:17 by 郁闷男人
邮箱:zhhoudac@163.com
最好是struts+spring+ibatis的例子

谢谢楼主了啊 急用啊。。。
这几天被JasperReport 搞的头晕

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-10-08 11:53 by wyyl1
我的邮箱:abouluo@gmail.com
急需你lib下的包
我的MSN:abouluo@hotmail.com

怎么联系你啊?

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-10-10 13:39 by tlj
发给我一份,谢谢。tianlijun100@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-10-16 09:14 by 刘旭
非常好。麻烦你能发给我一份么?suny86@tom.com

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2008-10-23 16:22 by hehe
不错不错,希望lz可以发一份给我,chensp1230@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-10-28 11:06 by chhzhou
谢谢楼主,能发给我一份么?chhzhou1985@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-10-29 08:24 by xuying
楼主 发一份Struts2+JasperReport Web报表应用示例 给我吧 现在项目正急用 dlxuying@126.com 将不胜感激啊

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-10-29 09:55 by xuying
急需你lib下的包 dlxuying@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-11-11 16:03 by fanning
楼主能给我一份吗,我的邮箱是 fanning1983@163.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-11-30 14:06 by 曾招兴
请楼主给我一份勒,我的邮箱是 374536189@qq.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-11-30 23:09 by xjwang
请楼主给我一份勒,我的邮箱是 37294663@qq.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-01 13:31 by lvq810
请给我发一份lib lvq810@163.com 谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-05 11:35 by ireport
请把源码发给我一份,不胜感激!
lujuju@qq.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-09 09:21 by loong
请把源码发给我一份,topdragon1985@gmail.com 谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-14 23:33 by billcsh
很受启发。请把LIB包发给我一份万分感谢!
email:billcsh@126.com

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-15 10:16 by 浪人
请给我发一份lib zhangyong1590@163.com谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-15 16:08 by 浪人
我现在急用呀 请给我发一份lib zhangyong1590@163.com谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-22 09:41 by cjf
我现在也急用,请给我发一份lib cjf20005@126.com谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-23 22:49 by renbao
22624223@qq。com我也要一份源码,谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-25 16:39 by shellyhopper
谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2008-12-27 18:12 by cjf
136374932@qq.com我也要一份源码,谢谢

# re: 整合Struts2+JasperReport Web报表应用示例  回复  更多评论   

2009-01-05 17:41 by Kam
我也要一份源码,谢谢
kaminmacau@163.com

# re: 整合Struts2+JasperReport Web报表应用示例[未登录]  回复  更多评论   

2009-02-13 11:48 by joyce
也发一份给我可以吗,joyce.1984@163.com,谢谢了
评论共2页: 上一页 1 2 

只有注册用户登录后才能发表评论。


网站导航: