struts2报表开发()
Install JasperReports plug ins
The strange thing is that the struts- in the JasperReports plug-in does not inherit the struts-default package.
Modify to make inheritance struts-default package.
< XML version= "1" encoding= "UTF-8"? >
<! DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration //EN""
"Http://struts./dtds/struts-" >
<struts>
<package name=, "jasperreports-default", "extends=", "struts-default" >
<result-types>
<result-type name= "Jasper" class= "" / >
</result-types>
</package>
</struts>
======================================
One, --
Package lee;
.;
Import .*;
Public class JasperAction extends ActionSupport
{
Public List getBookList ()
{
List result = new ArrayList ();
(New Book (1), " book", "Li Gang");
(New Book (2), lightweight J2EE enterprise bat, "Li Gang");
(New Book (3), "J2EE based Ajax collection", "Li Gang");
Return result;
}
}
-
Two, configure JasperAction--
< XML version= "1" encoding= "GBK"? >
<! DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration //EN""
"Http://struts./dtds/struts-" >
<struts>
<constant name= "" value= "messageResource" / >
<constant name= "" value= "GBK" / >
<package name=, "Lee", "extends=", "jasperreports-default" >
<action name=, "export", "class=", "" >
<result name=, "ess", "type=", "Jasper" >
<param name= "location" >jasper\</param>
<param name= "format" >HTML</param>
<param name= "dataSource" >bookList</param>
</result>
</action>
</package>
</struts>
----
1, when Result is Jasper type, three attributes need to be configured.
Location specifies the location of file used to generate the report. In the root directory of the
struts2报表开发() 来自淘豆网www.taodocs.com转载请标明出处.