Hello all,
i'm using the jasperreports-plugin for struts2.
I've created some reports using iReport. When i export a report in any format other than HTML, the report is correctly generated. But when i try to export it in HTML, the browser doesn't find any image.
For reports without charts it isn't a big problem, in them a "px" image is missing. Since it is a static image it is not a great problem, i found a quick workaround and maybe later i will try to force the export parameters to not use images to fill spaces.
My real problem is when i try to generate reports containing charts. The browser doesn't find any of the generated images.
I would like to know what is going wrong, or at least if and where the generated images are stored in a temp folder.
Here is the action definition in my struts.xml:
1 Answer:
I finally solved my problem, mixing the various information I found online and expecially understanding better how to configure struts2.
Jasper Reports uses a servlet called ImageServlet to handle images, so what i needed to do was:
- Register Jasper Reports ImageServlet in Tomcat
- Configure Struts to not map requests to ImageServlet into actions
- Modify the action in struts.xml to make it use ImageServlet
Register the ImageServlet (in Tomcat's web.xml)
Configure Struts (in struts.xml)
<constant name="struts.action.excludePattern" value="/servlets/image*" />
Modify Action (in struts.xml)
There was no need for the package "px" in struts.xml I added at first.