`
ksjx0014278
  • 浏览: 16940 次
  • 性别: Icon_minigender_1
  • 来自: 大连
最近访客 更多访客>>
社区版块
存档分类
最新评论

struts2 以报表输出的问题

    博客分类:
  • java
阅读更多

struts2 spring hibernate3 eclipse3.3.2 相关问题

在做 报表输出的时候 把按照条件搜索出来的数据 以 PDF CSV的形式输出 出现如下错误:

下面给出部分代码:

model层存放的是hibernate 生成的与数据库对应的两个文件 这里不给出 给出 表的字段:

id  name  author publish  time isbn page content

dao层

public class EmpbookDaoImpl extends HibernateDaoSupport implements EmpbookDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<Empbook> getEmpbook() {
		// TODO Auto-generated method stub
		String sql = "from Empbook empbook";
		List<Empbook> list = this.getHibernateTemplate().find(sql);
		return list;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List getQuery() {
		// TODO Auto-generated method stub
		String sql = "from Empbook empbook";
		List<Empbook> list = this.getHibernateTemplate().find(sql);
		return list;
	}

	

}

 

service 层

public class EmpbookServiceImpl implements EmpbookService {

	EmpbookDao empbookDao;
	@Override
	public List<Empbook> getEmpbook() {
		// TODO Auto-generated method stub
		return empbookDao.getEmpbook();
	}
	public EmpbookDao getEmpbookDao() {
		return empbookDao;
	}
	public void setEmpbookDao(EmpbookDao empbookDao) {
		this.empbookDao = empbookDao;
	}
	@SuppressWarnings("unchecked")
	@Override
	public List getQuery() {
		// TODO Auto-generated method stub
		return empbookDao.getQuery();
	}

}

 
 action 层

public class EmpbookAction extends ActionSupport {

	EmpbookService empbookService;
//	Empbook Empbook;
	
	private String id;
	private String name;
	private String author;
	private String publish;
	private String time;
	private String isbn;
    private int page;
	private String content;
//get set 方法省略	
	private List<Empbook> availableItems;
	
	public String Display() throws Exception{
		
		Empbook p1 = new Empbook("sdf","asd","sds","sdsd","sds","ds",50,"sdf");
		Empbook p2 = new Empbook("wqe","www","sddss","sdadsd","swqewqds","dqwes",510,"sdfqwewq");
		Empbook p3 = new Empbook("qwe","awd","ssds","sdwqewqsd","swqewqeds","dqweqws",150,"swqewqdf");
	 availableItems = new ArrayList<Empbook>();
	 availableItems.add(p1);
	 availableItems.add(p2);
	 availableItems.add(p3);
	 try {
	      String reportSource;
	      reportSource=ServletActionContext.getServletContext().getRealPath("/jasper/jasper_template.jrxml");
	      File parent = new File(reportSource).getParentFile();
	      JasperCompileManager.compileReportToFile(reportSource,
	        new File(parent, "compiled_jasper_template.jasper").getAbsolutePath());
	    }catch (Exception e) {
	      e.printStackTrace();
	    }
	 return SUCCESS;
	}

 struts.xml

<action name="CSV" 
         class="com.myapp.struts2.action.EmpbookAction" method="Display">
        <result name="success">
          <param name="location">/jasper/compiled_jasper_template.jasper</param>
          <param name="dataSource">availableItems</param>
          <param name="format">CSV</param>
        </result>
      </action>
      <action name="PDF" 
             class="com.myapp.struts2.action.EmpbookAction" method="Display">
        <result name="success">
          <param name="location">/jasper/compiled_jasper_template.jasper</param>
          <param name="dataSource">availableItems</param>
          <param name="format">PDF</param>
        </result>
      </action>

 jsp

<tr>
<td>
    <select name="fieldname" >
        <option value="gameNameCn">中文名称</option>
        <option value="gameNameEn">英文名称</option>
        <option value="gameCapacity">碟数</option>
        <option value="gameVersion">版本</option>
        <option value="gameMedia">介质</option>
        <option value="gameCopyright">版权</option>
    </select>
    <input value="" name="value"  />
<a href="#" onclick="btnQuery()">查询</a>
<br><a href="CSV.action">CSV</a>
<br><a href="PDF.action">PDF</a>

</tr>

</table>
 
</s:form>
</body>

 

jasper_template.jrxml

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport
PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="jasper_test">
<!-- our fields -->
<field name="id" class="java.lang.String" />
<field name="name" class="java.lang.String" />
<field name="author" class="java.lang.String" />
<field name="publish" class="java.lang.String" />
<field name="time" class="java.lang.String" />
<field name="isbn" class="java.lang.String" />
<field name="page" class="java.lang.String" />
<field name="content" class="java.lang.String" />
<title>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="180" height="15" />
<textElement />
<text>
<![CDATA[Struts2 JasperReports Sample]]>
</text>
</staticText>
</band>
</title>
<pageHeader>
<band></band>
</pageHeader>
<columnHeader>
<band height="20">
<staticText>
<reportElement x="180" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Id]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Name]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Author]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Publish]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Time]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Isbn]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Page]]>
</text>
</staticText>
<staticText>
<reportElement x="360" y="0" width="180" height="20" />
<textElement>
<font isUnderline="true" />
</textElement>
<text>
<![CDATA[Content]]>
</text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20">
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{id}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{name}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{author}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{publish}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{time}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{isbn}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="180" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{page}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x="360" y="0" width="180" height="15" />
<textElement />
<textFieldExpression>
<![CDATA[$F{content}]]>
</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band></band>
</columnFooter>
<pageFooter>
<band height="15">
<staticText>
<reportElement x="0" y="0" width="40" height="15" />
<textElement />
<text>
<![CDATA[Page:]]>
</text>
</staticText>
<textField>
<reportElement x="40" y="0" width="100" height="15" />
<textElement />
<textFieldExpression class="java.lang.Integer">
<![CDATA[$V{PAGE_NUMBER}]]>
</textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band></band>
</summary>
</jasperReport>

 

错误如下:

2008/07/01 15:13:34 org.apache.catalina.core.StandardWrapperValve invoke
致命的: サーブレット default のServlet.service()が例外を投げました
java.lang.ClassNotFoundException: org.apache.commons.digester.Digester
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:116)
	at com.myapp.struts2.action.EmpbookAction.Display(EmpbookAction.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
	at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
	at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
	at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
	at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)

 请帮帮忙 着急要结果

 

如果是 多个表 a b c 相关联 按照多个条件进行检索 把结果在jsp 显示出来 并以 PSD CSV 形式输出 数据是从数据库中查询得到的 应该如何修改呢?

分享到:
评论

相关推荐

    struts2整合JfreeChart完成报表功能

    整合Struts2和JFreeChart,主要是为了在web应用中展示动态生成的数据图表,例如报表。以下是整合的步骤和关键知识点: 1. **下载和引入JFreeChart库**: 首先,你需要从JFreeChart的官方网站...

    Struts2整合jasperReports报表

    7. **返回响应**:Action执行完毕后,Struts2会将报表内容作为HttpServletResponse的输出流返回给客户端,用户即可下载或查看报表。 在整个过程中,关键在于理解Struts2的Action机制和jasperReports的数据填充及...

    struts2导出报表

    ### Struts2导出报表知识点解析 #### 一、Struts2框架简介 Struts2是一个基于MVC(Model-View-Controller)设计模式的Java Web应用开发框架,它简化了Web应用程序的开发过程,提供了丰富的插件支持,使得开发者...

    Struts2与Jasperreport报表结合

    Struts2作为MVC(模型-视图-控制器)架构的一部分,主要用于处理HTTP请求并管理应用程序流程,而JasperReport则是一个强大的报告生成工具,能够创建复杂的报表设计,并以各种格式如PDF、HTML、Excel等导出。...

    struts2 jasper iReport 报表

    你可以实现用户在Web界面上请求报表,后台服务通过Struts2框架处理请求,调用JDBC或ORM框架(如Hibernate)从数据库获取数据,将数据封装成Javabean集合,然后使用JasperReports API生成报表,最后将报表以用户指定...

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

    Struts2是一个强大的MVC(模型-视图-控制器)框架,用于构建结构清晰、可维护性高的Web应用程序,而JasperReport则是一个功能丰富的报告生成库,能够创建复杂的报表并支持多种输出格式,如HTML、PDF等。 在"整合...

    Struts2_JasperReport整合的例子

    Struts2是一个强大的MVC框架,用于构建动态、数据驱动的Web应用程序,而JasperReport则是一个开源的报表工具,可以生成丰富的报表,支持多种输出格式如PDF、HTML、Excel等。下面我们将深入探讨这两者如何整合以及...

    ireport+struts2实现web开发

    - 使用Struts2的Result类型,如stream或freemarker,将报表以流形式发送到客户端浏览器。 4. 示例代码: 一个简单的Action类方法可能如下所示: ```java public String generateReport() throws Exception { ...

    struts2.2.3加载的核心jar包

    5. **Struts2的标签库**:struts2-tiles-plugin.jar 和 struts2-jasperreports-plugin.jar 等插件分别提供了对Tiles和JasperReports的支持,前者用于页面布局,后者则帮助生成复杂的报表。 6. **依赖的第三方库**:...

    struts2.0 hibernate spring 报表实例

    JasperReports可以与FreeMarker模板引擎一起工作,通过Struts2的Action调用来动态生成报表。 在实际应用中,通常会有一个Action类处理用户的请求,该类可能通过Spring的依赖注入获取到Hibernate管理的数据访问对象...

    Jxls结合Struts2下载

    标题 "Jxls结合Struts2...通过理解以上知识点,开发者可以有效地在Struts2应用中整合Jxls,实现动态Excel报表的生成和下载功能。这在企业级应用中非常常见,特别是在需要导出大量结构化数据或生成定制化报告的场景下。

    struts2文件上传下载

    在Struts2中进行文件上传时,必须在标签中指定`enctype="multipart/form-data"`,这样表单的数据才会以二进制流的形式发送,而不是默认的URL编码。在给定的内容中,`&lt;s:form&gt;`标签已经正确设置了`enctype`属性。 2...

    Struts2集成jasperreport3.7.1所需的Jar包

    Struts2是一个流行的Java Web应用程序框架,用于构建...总的来说,这些库文件构成了Struts2集成JasperReport的基础,使得开发者可以在Web应用中轻松地创建和展现丰富的报表,同时利用Struts2的强大功能进行交互和控制。

    Struts2AndJasperReport实例

    Struts2 是一个基于 Model-View-Controller(MVC)架构模式的 web 应用框架,而 JasperReport 是一个用于创建、设计和展示报表的库,它支持多种数据源和输出格式。 首先,让我们深入了解一下 Struts2。Struts2 是 ...

    Struts2与jasperReport简单示例

    6. **展示或下载报表**:在视图(通常是JSP)中,根据Action返回的报表实例,使用Struts2的标签库或自定义标签来输出报表。用户可以选择在浏览器中查看,或者通过设定响应头触发下载。 7. **优化与扩展**:为了提高...

    struts2-lib

    - `struts2-jasperreports-plugin.jar`:集成JasperReports,用于报表生成。 - `struts2-taglib.jar`:Struts2自定义标签库,用于简化JSP页面开发。 4. **插件和扩展**: - `struts2-spring-plugin.jar`:与...

    struts2 + jasper report

    总结来说,`struts2 + jasper report`的组合为Java Web应用提供了强大的报表生成能力,通过Struts2的控制层管理和JasperReport的报表引擎,可以方便地将后台数据转化为直观的报表展示给用户。在项目`...

    Struts2 + JasperReport应用一:导PDF,Excel,HTML显示

    - 考虑性能问题,大型报表可能需要分页或异步处理,以避免阻塞服务器资源。 - 处理可能的异常情况,例如数据源未找到、模板错误等,并提供合适的错误信息反馈。 在提供的压缩包文件`lib2`中,可能包含了Struts2、...

    struts2+poi实现导出Excel文件

    然后,将这个输出流作为输入流提供给 Struts2 的结果配置,通过 `HttpServletRequest` 获取请求响应对象,设置响应头(如 Content-Type 和 Content-Disposition),最后将输出流写入响应输出流,完成文件下载。...

Global site tag (gtag.js) - Google Analytics