0
votes

I am working on Spring, JasperReports. My Spring version is 3.0.5 RELEASE, iReport-4.5.0.

I am using http://chathurangat.blogspot.in/2012/02/jasperreport-with-spring-mvc-fully.html link as sample to generate the reports. For this every thing is working fine. But when i am exporting the report to html i am not able to get the images. For this I have configured imageservlet in my web.xml and IMAGES_URI, IMAGES_DIR_NAME, IS_OUTPUT_IMAGES_TO_DIR, IS_USING_IMAGES_TO_ALIGN parameters in jasper-views.xml file.

Below is the configuration of my code in jasper-views.xml, web.xml.

Using this configurations if i run the report i am getting the 500 Error as no jasperprint document found on the httpsession.

If i configure the DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE attribute then I've get the image. But i am not getting how to configure this in jasper-views.xml file. This attribute is expecting the JasperPrint object but i am not creating any JasperPrint object.

Can any one help me regarding this. I am struggling a lot for this. If you want any more information i vl give you.

This is my jasper-views.xml configuration:

        <util:map id="exportParameterMap">
                <entry key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN">
                        <value>false</value>
                </entry>
                 <entry key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR">
                        <value>true</value>
                </entry> 
                 <entry key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI">
                    <value>images?image=</value>
                 </entry> 
                 <entry key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_DIR_NAME">
                    <value>/home/rupa/Workspace/sample/src/main/webapp/images/rupa</value>
                 </entry> 
        </util:map>
         <bean id="ipHtmlReport"
          class="org.springframework.web.servlet.view.jasperreports.JasperReportsHtmlView"
          p:url="classpath:reports/ggsnreport.jrxml"
          p:reportDataKey="datasource"
          p:exporterParameters-ref="exportParameterMap">

         </bean>

This is my web.xml configuration:

        <servlet>
                   <servlet-name>image</servlet-name>
                   <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
                   <load-on-startup>2</load-on-startup>
        </servlet>

        <servlet-mapping>
                   <servlet-name>image</servlet-name>
                   <url-pattern>/images</url-pattern>

        </servlet-mapping>
1

1 Answers

0
votes

I haven't done it with a pure Spring approach. I have part of the site with Spring, but the reports are generated using traditional Servlets.

If it is helpful to you, you can see this answer I wrote for a similar question.