Spring Web MVC - Spring Web Flow Working With JasperReports
Step 1: Creating the structure folders
To do this tutorial quickly and easily, create a Tomcat project called springjasperreports in the webapps folder of your Tomcat installation. I will show you a structure of all folders inside the project (would change according your logic). At first glance it can be a little confusing but later it will be easier to understand.
Step 2: Configuring web.xml
<display-name>springjasperreports</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>springjasperreports.root</param-value>
</context-param>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/springjasperreports-servlet.xml
/WEB-INF/xml/context/applicationContext-swf.xml
/WEB-INF/xml/context/applicationContext-jasperreports.xml
/WEB-INF/xml/context/applicationContext-jasperreportsengine.xml
</param-value>
</context-param>
<servlet>
<servlet-name>springjasperreports</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>detectAllViewResolvers</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet-mapping>
<servlet-name>springjasperreports</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
An important part would be contextConfigLocation, there you can see
- /WEB-INF/springjasperreports-servlet.xml (for view resolver,url mapping, and some Web MVC beans)
- /WEB-INF/xml/context/applicationContext-swf.xml (for flow configuration)
- /WEB-INF/xml/context/applicationContext-jasperreports.xml (for a controller to handle a request )
- /WEB-INF/xml/context/applicationContext-jasperreportsengine.xml (for our report engine)
- Login or register to post comments
- 29745 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)










Comments
clermont38 replied on Fri, 2009/05/15 - 12:18pm
cnbaluramesh replied on Sat, 2009/06/13 - 4:03am
vijayasaradhi_p replied on Tue, 2009/08/18 - 10:56pm
rajesh_dzone replied on Sun, 2009/09/27 - 9:47pm
zizul replied on Fri, 2009/11/13 - 5:24am
Manuel Jordan replied on Sat, 2009/11/14 - 10:23pm
Hello Guys
The source is almost available.
My hard disk crushed months ago, and the source code is somewhere among many DVD,
Regards