Announcement Announcement Module
Collapse
No announcement yet.
Spring+Jasper Report: resource mapping question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring+Jasper Report: resource mapping question

    I can not open my jasper report, here is my configurations:

    my web.xml:
    Code:
    ...
    <servlet>
    		<servlet-name>reportApp</servlet-name>
    		<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>reportApp</servlet-name>
    	  	<url-pattern>/reportApp/*</url-pattern>
    	 </servlet-mapping>
    ...
    reportApp-servlet.xml:
    Code:
    
    <bean id="report" class="com.school.reports.ReportTestController">
    		<property name="reportService">
    			<ref bean="reportService"/>
    		</property>
    	</bean>
    	
    	<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="report">report</prop>
                	<prop key="reportXls">report</prop>
                </props>
            </property>
        </bean>
    	
    	
    	<!-- jasperreports viewresolver -->
    	<bean id="viewResolver"
        	  class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
      		<property name="basename" value="views"/>
    	</bean>
    views.properties:
    Code:
    report.class=org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView
    report.url=/WEB-INF/reports/chenTest2.jasper
    
    reportXls.class=org.springframework.web.servlet.view.jasperreports.JasperReportsXlsView
    reportXls.url=/WEB-INF/reports/chenTest2.jasper
    reportTestController.java:
    Code:
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
    
    Map[] objList=reportService.initializeMapArray(userId);
        	JRMapArrayDataSource dataSource = new JRMapArrayDataSource(objList);
        	
        	model.put("JRDataSource", dataSource);
    
    if(format.equals("pdf"))
        		return new ModelAndView("report", model);
        	if(format.equals("xls"))
        		return new ModelAndView("reportXls", model);
        		
        	else
        		return new ModelAndView("report", model);
    
    ...
    when I type the following URL on browswer, the report does not shown:
    http://localhost:8080/reportApp/report?param="+userId+"&format=pdf

    browser shows msg:
    HTTP ERROR: 404

    NOT_FOUND

    RequestURI=/reportApp/report


    why? how to solve?
Working...
X