- 浏览: 122329 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (131)
- J2EE (5)
- 系统配置 (2)
- eclipse (3)
- MySQL (3)
- 数据库 (1)
- log4j (2)
- hibernate (5)
- JBOSS (3)
- https (2)
- Struts2 (7)
- javascript (2)
- CSS (4)
- HTTP (2)
- J2SE (1)
- apache (6)
- XML (1)
- android (3)
- session (3)
- Spring (3)
- 前端优化 (2)
- Drools (2)
- java笔试题 (8)
- SVN (2)
- linux (19)
- linux命令 (3)
- memcache (1)
- Servlet (2)
- Java RMI (1)
- 领域模型 (1)
- LVS (4)
- Linux shell (2)
- WEB (1)
- F5 (2)
- WinRAR (1)
- TCP (1)
- MQ (2)
- weblogic (1)
- winxp安装FTP (1)
- WebLogic和Tomcat (1)
- 虚拟机 (1)
- nexus-maven (1)
- jstl (1)
- jvm (1)
- Redis (2)
- mongodb (3)
- JAVA (2)
- mybatis (1)
- SQLserver (1)
- GC (1)
- zabbix (1)
- node (1)
最新评论
-
huosange:
简单明了,通俗易懂
JAVA为什么只允许单继承
被这个问题困扰了好几天,今天终于解决。现在我将呈现如何用Struts2整合jasperreport生成pdf文件,并且提供查看和下载功能:
一,制作jasper模版
首先我才用的是ireport4.1.3制作模版,模版代码如下:
一,制作jasper模版
首先我才用的是ireport4.1.3制作模版,模版代码如下:
<?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report3" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="0"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="263"/> <style name="table"> <box> <pen lineWidth="1.0" lineColor="#000000"/> </box> </style> <style name="table_TH" mode="Opaque" backcolor="#F0F8FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_CH" mode="Opaque" backcolor="#BFE1FF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_TD" mode="Opaque" backcolor="#FFFFFF"> <box> <pen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="Table Dataset 1"/> <parameter name="chineseName" class="java.lang.String"/> <parameter name="englishName" class="java.lang.String"/> <parameter name="memberNo" class="java.lang.String"/> <parameter name="memberTier" class="java.lang.String"/> <parameter name="IDCard" class="java.lang.String"/> <parameter name="passport" class="java.lang.String"/> <parameter name="others" class="java.lang.String"/> <parameter name="applyDate" class="java.lang.String"/> <parameter name="memberTierEN" class="java.lang.String"/> <field name="flightDate" class="java.sql.Timestamp"/> <field name="flightNumber" class="java.lang.String"/> <field name="departureAirport" class="java.lang.String"/> <field name="arriveAirport" class="java.lang.String"/> <background> <band height="807" splitType="Stretch"> <image> <reportElement x="0" y="0" width="555" height="807"/> <imageExpression><![CDATA["http://10.103.99.6/skypearl/jasreportTemplete/visabackgroundone.jpg"]]></imageExpression> </image> </band> </background> <title> <band height="491" splitType="Stretch"> <staticText> <reportElement x="0" y="110" width="555" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="15" isBold="true" isItalic="false" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> <paragraph lineSpacing="Single"/> </textElement> <text><![CDATA[南航明珠俱乐部金、银卡认证信 ]]></text> </staticText> <staticText> <reportElement x="0" y="194" width="555" height="27"/> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[Personal Information in the China Southern Airlines Sky Pearl Club ]]></text> </staticText> <staticText> <reportElement x="0" y="221" width="54" height="20"/> <textElement verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[中文姓名]]></text> </staticText> <staticText> <reportElement x="0" y="241" width="54" height="20"/> <textElement verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[英文姓名]]></text> </staticText> <staticText> <reportElement x="0" y="261" width="54" height="24"/> <textElement verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[会员号码]]></text> </staticText> <staticText> <reportElement x="0" y="285" width="54" height="20"/> <textElement verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[会员级别]]></text> </staticText> <textField isBlankWhenNull="true"> <reportElement x="159" y="221" width="396" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$P{chineseName}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="201" y="241" width="354" height="22"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$P{englishName}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="180" y="261" width="375" height="24"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$P{memberNo}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="159" y="285" width="106" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <textFieldExpression><![CDATA[$P{memberTier}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="305" width="77" height="22"/> <textElement verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[会员旅行证件]]></text> </staticText> <staticText> <reportElement style="table_TH" stretchType="RelativeToTallestObject" x="159" y="327" width="293" height="22"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement style="table_TH" stretchType="RelativeToTallestObject" x="0" y="349" width="159" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement style="table_TH" stretchType="RelativeToTallestObject" x="0" y="369" width="159" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement style="table_TH" stretchType="RelativeToTallestObject" x="0" y="389" width="164" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[]]></text> </staticText> <textField isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="159" y="349" width="293" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$P{IDCard}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="159" y="369" width="293" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$P{passport}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="159" y="389" width="293" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$P{others}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="434" width="575" height="18"/> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[Flight Information within the previous 24 month period in the China Southern Airlines Sky Pearl Club]]></text> </staticText> <staticText> <reportElement x="0" y="137" width="555" height="34"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true" isPdfEmbedded="false"/> </textElement> <text><![CDATA[China Southern Airlines Sky Pearl Club Gold and Silver Card Letter of Certification]]></text> </staticText> <staticText> <reportElement x="0" y="171" width="555" height="23"/> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[在南航明珠俱乐部登记的个人资料]]></text> </staticText> <staticText> <reportElement x="54" y="221" width="110" height="20"/> <textElement verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[ Name in Chinese: ]]></text> </staticText> <staticText> <reportElement x="51" y="241" width="161" height="22"/> <textElement verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[ Name in English or Pinyin: ]]></text> </staticText> <staticText> <reportElement x="54" y="263" width="136" height="22"/> <textElement verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[ Membership Number:]]></text> </staticText> <staticText> <reportElement x="54" y="285" width="110" height="20"/> <textElement verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[ Membership Tier: ]]></text> </staticText> <staticText> <reportElement x="77" y="305" width="246" height="22"/> <textElement verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[ Member’s Travel Document:]]></text> </staticText> <staticText> <reportElement style="table_TH" x="0" y="327" width="159" height="22"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement x="0" y="327" width="54" height="22"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[旅行证件]]></text> </staticText> <staticText> <reportElement x="54" y="327" width="105" height="22"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12"/> </textElement> <text><![CDATA[ Travel Document]]></text> </staticText> <staticText> <reportElement stretchType="RelativeToTallestObject" x="0" y="349" width="54" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[身份证]]></text> </staticText> <staticText> <reportElement stretchType="RelativeToTallestObject" x="51" y="349" width="108" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12"/> </textElement> <text><![CDATA[ID Card]]></text> </staticText> <staticText> <reportElement stretchType="RelativeToTallestObject" x="0" y="369" width="54" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[护照]]></text> </staticText> <staticText> <reportElement stretchType="RelativeToTallestObject" x="54" y="389" width="105" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12"/> </textElement> <text><![CDATA[Passport]]></text> </staticText> <staticText> <reportElement stretchType="RelativeToTallestObject" x="0" y="389" width="54" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[其他]]></text> </staticText> <staticText> <reportElement stretchType="RelativeToTallestObject" x="54" y="369" width="105" height="20"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12"/> </textElement> <text><![CDATA[Others]]></text> </staticText> <staticText> <reportElement x="159" y="327" width="139" height="22"/> <textElement textAlignment="Right" verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[号码 ]]></text> </staticText> <staticText> <reportElement x="298" y="327" width="154" height="22"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font size="12"/> </textElement> <text><![CDATA[Number]]></text> </staticText> <staticText> <reportElement x="0" y="419" width="575" height="18"/> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[在南航明珠俱乐部登记的24个月内乘机记录]]></text> </staticText> <textField isBlankWhenNull="true"> <reportElement x="201" y="285" width="354" height="20"/> <textElement verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$P{memberTierEN}]]></textFieldExpression> </textField> <image> <reportElement x="0" y="0" width="555" height="110"/> <imageExpression><![CDATA["http://10.103.99.6/skypearl/jasreportTemplete/yemei.jpg"]]></imageExpression> </image> <staticText> <reportElement style="table_TH" mode="Opaque" x="190" y="461" width="131" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement style="table_TH" mode="Opaque" x="0" y="461" width="95" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement style="table_TH" mode="Opaque" x="95" y="461" width="95" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement style="table_TH" mode="Opaque" x="321" y="461" width="131" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="false"/> </textElement> <text><![CDATA[]]></text> </staticText> <staticText> <reportElement x="0" y="476" width="95" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[Date of Flight]]></text> </staticText> <staticText> <reportElement x="95" y="476" width="95" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[Flight Number]]></text> </staticText> <staticText> <reportElement x="321" y="461" width="131" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[目的地]]></text> </staticText> <staticText> <reportElement x="321" y="476" width="131" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[To]]></text> </staticText> <staticText> <reportElement x="190" y="476" width="131" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[From]]></text> </staticText> <staticText> <reportElement x="190" y="461" width="131" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[始发地]]></text> </staticText> <staticText> <reportElement x="95" y="461" width="95" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[航班号]]></text> </staticText> <staticText> <reportElement x="0" y="461" width="95" height="15"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[航班日期 ]]></text> </staticText> </band> </title> <pageHeader> <band splitType="Stretch"/> </pageHeader> <columnHeader> <band/> </columnHeader> <detail> <band height="19" splitType="Stretch"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="95" y="0" width="95" height="19"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$F{flightNumber}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="190" y="0" width="131" height="19"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$F{departureAirport}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="yyyy/MM/dd" isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="0" y="0" width="95" height="19"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$F{flightDate}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement style="table_TD" stretchType="RelativeToTallestObject" x="321" y="0" width="131" height="19"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression><![CDATA[$F{arriveAirport}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band/> </columnFooter> <pageFooter> <band height="25" splitType="Stretch"/> </pageFooter> <lastPageFooter> <band height="187"> <staticText> <reportElement x="0" y="0" width="54" height="22"/> <textElement verticalAlignment="Middle"> <font size="12" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> </textElement> <text><![CDATA[申请日期]]></text> </staticText> <textField isBlankWhenNull="true"> <reportElement x="164" y="0" width="389" height="22"/> <textElement verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$P{applyDate}]]></textFieldExpression> </textField> <staticText> <reportElement x="54" y="0" width="122" height="22"/> <textElement verticalAlignment="Middle"> <font size="12" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA[Date of Application:]]></text> </staticText> <image> <reportElement x="0" y="22" width="553" height="165"/> <imageExpression><![CDATA["http://10.103.99.6/skypearl/jasreportTemplete/yejiaoone.jpg"]]></imageExpression> </image> </band> </lastPageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport>
发表评论
-
struts2实例
2013-04-12 11:24 714Struts2使用拦截器完成权限控制示例 文章分类:Java编 ... -
Struts1与Struts2的特点与比较
2013-04-12 11:17 1022Struts1与Struts2的特点与 ... -
struts2整合jasper模版生成PDF导出下载<四>
2012-08-18 14:57 2645(2)先生成pdf文件,然后通过strut2下载: resp ... -
struts2整合jasper模版生成PDF导出下载<三>
2012-08-18 14:34 1474三,编写java程序,生成pdf文件 此处有多钟方式:也可以 ... -
struts2整合jasper模版生成PDF导出下载<二>
2012-08-18 14:24 1083jasperreport模版制作过程可参见: http://w ... -
struts2弹出下载页面
2012-07-30 15:25 783有时候配置struts2的action时:少了<para ...
相关推荐
Struts2是一个流行的Java Web应用程序框架,它提供了MVC(模型-视图-控制器)架构,而JasperReport则是一个强大的报表生成库,可以生成多种格式的报表,如PDF、HTML、Excel等。iReport是JasperReport的可视化设计...
总结来说,`struts2 + jasper report`的组合为Java Web应用提供了强大的报表生成能力,通过Struts2的控制层管理和JasperReport的报表引擎,可以方便地将后台数据转化为直观的报表展示给用户。在项目`...
在“Struts2 + JasperReport应用一:导PDF,Excel,HTML显示”这个主题中,我们将深入探讨如何整合这两个技术,以实现动态生成并导出不同格式的报表。首先,我们需要确保在项目中引入了必要的库,这可能包括Struts2...
Struts2是一个流行的Java Web应用程序框架,用于构建和管理MVC(模型-视图-控制器)架构的应用。它提供了一种结构化的开发方式,增强了应用的可维护性和可扩展性。另一方面,jasperReports是一款强大的开源报表工具...
Struts2、 Jasper 和 iReport 是Java开发领域中用于创建动态和复杂的报表的重要工具。Struts2是一个基于MVC(模型-视图-控制器)架构的Web应用框架,它为开发者提供了一种组织和控制应用程序逻辑的方式。...
6. **Struts2配置**:在Struts2的配置文件(struts.xml)中,定义一个导出Excel的Action,返回类型设置为流类型(通常为“stream”),并将生成的Excel内容设置到HttpServletResponse的输出流中。 7. **Action实现*...
将这两者整合,可以让Struts2应用程序轻松地实现动态报告的生成与展示。 在整合Struts2和JasperReport时,我们需要一些特定的jar包来确保两者能正确通信和协同工作。这些jar包通常包含了Struts2的核心组件、...
Struts2.1和JasperReport的整合是Java Web开发中的一个重要话题,它涉及到Web应用程序的MVC(模型-视图-控制器)架构和数据报告的生成。Struts2.1是一个强大的MVC框架,而JasperReport则是一个用于创建复杂报表的...
总的来说,"jasperreports-5.5.1_struts2.3整合用到的jar包"为开发者提供了一站式的解决方案,帮助他们快速地在Struts2应用中实现报表功能。有了这个资源,开发者可以省去寻找和验证各个依赖的过程,更专注于报表的...
<param name="format">PDF</param> </result> </action> <!-- 可以添加更多格式的导出 --> </package> ``` #### 参数解释 - `location`:指向JasperReport生成的.jasper文件的路径。 - `dataSource`:指向数据...
Struts2 + JasperReports4 + DB2 Demo是一个典型的Java企业级应用示例,结合了流行的MVC框架Struts2、报表工具JasperReports4以及关系型数据库DB2,用于展示如何在实际项目中进行数据展示和处理。在这个项目中,...
Struts2是一个流行的Java web框架,它为开发者提供了一种结构化的方式来构建应用程序,而JasperReports则是一款强大的报告生成工具。将JasperReports与Struts2整合,可以帮助我们在Web应用中轻松创建复杂的报表。 ...
在Struts2 Action中,根据业务逻辑获取数据,然后使用JasperReport API填充数据到`.jasper`模板,生成最终的报表(如PDF、HTML或Excel格式)。 5. **集成步骤**: - 在Struts2项目中添加JasperReport和iReport的...
总的来说,JasperReports和Struts2的结合提供了强大的动态报表生成能力,对于需要向用户展示复杂数据的应用来说,这是一种非常实用的解决方案。通过深入理解和实践"jasperreports 3 struts2开发资料",开发者可以...
客户端打印PDF以及服务器打印是Java开发中常见的需求,特别是当涉及到报表生成时,JasperReport是一个广泛使用的开源库。本文将深入探讨如何使用JasperReport进行客户端和服务器端的PDF打印。 首先,JasperReport是...
6. **Struts2集成**:在Struts2的Action类中,编写方法来处理报表请求,调用上述步骤生成并导出报表。Action的结果可以配置为一个流结果类型,直接将报表内容发送到浏览器。 7. **前端展示**:在HTML页面中,使用...