1. 设计器连接mysql数据库, 创建first.raq报表文件
2. 创建demo.jsp,嵌入报表,jsp顶部加入下面两行
<%@ page contentType="text/html;charset=GBK" %> <%@ taglib uri="/WEB-INF/runqianReport4.tld" prefix="report"%>
3. 将快逸目录下的webapps文件夹里的quiee文件夹复制到Tomcat目录下的webapps文件夹下
4.
将quieeReport\jdbc文件夹下的mysql-connector-java-5.1.5-bin.jar(mysql数据库的JDBC驱动包)拷贝到Tomcat目录下lib文件夹下
5. 然后配置Tomcat6的数据库连接池,打开Tomcat6目录conf文件夹下server.xml,在</Host>之前添加如下代码:
<Context path="/quiee" docBase="quiee" debug="0" privileged="true"> <Resource name="jdbc/report" auth="Container" type="javax.sql.DataSource" maxActive="10" maxIdle="30" maxWait="10000" username="root" password="" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1:3306/report" /> </Context>
6. 修改报表参数文件 将quiee/WEB-INF/reportConfig.xml 的dataSource节点修改为
<config> <name>dataSource</name> <value> jdbc/report,mysql;</value> </config>
7. 将quiee/WEB-INF/web.xml用下面的代码替换
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://Java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>reportServlet</servlet-name> <servlet-class> com.runqian.report4.view.ReportServlet </servlet-class> <init-param> <param-name>configFile</param-name> <param-value>/WEB-INF/reportConfig.xml</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>reportServlet</servlet-name> <url-pattern>/reportServlet</url-pattern> </servlet-mapping> <taglib> <taglib-uri>/WEB-INF/runqianReport4.tld</taglib-uri> <taglib-location>/WEB-INF/runqianReport4.tld</taglib-location> </taglib> </web-app>
8. 启动tomcat,查看效果 http://localhost:8080/quiee/jsp/demo.jsp