日期:2014-05-17 浏览次数:21013 次
<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" 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"> <display-name>ReportWebApp</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>jasperSpring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jasperSpring</servlet-name> <url-pattern>/jasperSpring/*</url-pattern> </servlet-mapping> </web-app>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Generate Report</title> </head> <body> Click on the button to generate the report. <form name="reportForm" action="jasperSpring/report" method="get"><input type="submit" name="submitButton" value="Submit" /></form> </body> </html>
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close"> <property name="driverClassName"> <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> </property> <property name="url"> <value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind</value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value>sa</value> </property> </bean> <bean id="publicUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="report">jasperController</prop> </props> </property> </bean> <bean id="jasperController" class="net.aachina.jasperreport.JasperSpringController"> <property name="dataSource"> <ref local="dataSource" /> </property> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"> <property name="basename" value="views" /> </bean> <bean id="ImageServlet" class="net.sf.jasperreports.j2ee.servlets.ImageServlet"> </bean> </beans>
report.class=org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView #report.class=org.springframework.web.servlet.view.jasperreports.JasperReportsHtmlView #report.class=net.aachina.jasperreport.render.JasperReportsHtmlView report.url=reports/ChartReportDemo.jasper