Announcement Announcement Module
Collapse
No announcement yet.
classes/views.properties Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • classes/views.properties

    hi!

    My problem is report views. I run the jasperdemo and works fine.
    I made a example from scratch and works fine, but when I put this reports
    in my application dont work!

    My controller returns

    Code:
    return new ModelAndView("userReportMulti", model);
    my views.properties

    Code:
    userReportMulti.class=org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView
    userReportMulti.url=/WEB-INF/reports/UserReport.jrxml
    userReportMulti.reportDataKey=myBeanData
    when I run in the web...

    Code:
    type Status report
    
    message /WEB-INF/jsp/userReportMulti.jsp
    
    description The requested resource (/WEB-INF/jsp/userReportMulti.jsp) is not available.
    why its appends .jsp?

    any ideas?

    thanks
    Fabio Falci

  • #2
    I have not worked with jasper reports, but how do you have your ViewResolver set up? Could be that it is appending .jsp to your viewName in the ModelAndView class.

    Comment


    • #3
      Hi,

      It's seems you're using a InternalResourceViewResolver with pre and postfix in place of a ResourceBundleViewResolver with baseName set to your view.properties

      Code:
      <bean id="ResourceViewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
      	<property name="basename"><value>views</value></property>
      </bean>
      Bye

      Steph

      Comment


      • #4
        I have 2 ViewResolver!

        Code:
        	<bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
        		<property name="basename">
        			<value>views</value>
        		</property>
        	</bean>
        	
        	<bean id="viewResolverJSP"
        		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        		<property name="prefix">
        			<value>/WEB-INF/jsp/</value>
        		</property>
        		<property name="suffix">
        			<value>.jsp</value>
        		</property>
        	</bean>
        but, this is not work!...
        then a commented viewResolverJSP and the reports work, but now just reports work...

        then I changed the name of viewResolver to viewResolverReport and uncommented the viewResolverJSP... now all works!!! thanks guys!!!

        do I need two viewResolver?

        thanks
        Fabio Falci

        Comment


        • #5
          Code:
          do I need two viewResolver?
          Why not ?

          Like you, i use InternalResourceViewResolver for jsp purpose and ResourceBundleViewResolver for specials views (PDF, Excel, etc...)

          However, you have to take care of calling your both viewResolver Beans with a different id (or the second one will override the first one).

          Finally, you could use the order property in order to avoid some conflicts with your both viewResolver :

          e.g : /WEB-INF/jsp/view.jsp

          Bye

          Steph

          Comment


          • #6
            about referenceData

            hi,

            New to Spring. Trying to use the SimpleFormController for my forms.
            for testing, I have two forms, A and B, and two corresponding controllers, Ac, and Bc. User fill out some info on A, hit submit, and goes to B.

            In Ac's onSubmit, I have this:

            return new ModelAndView(getSuccessView(), "model", myModel);

            When I do that, the referenceData() method in Bc was never called. So I changed it to:

            return new ModelAndView(new RedirectView(getSuccessView() + ".htm"), "model", myModel);

            Now referenceData() gets called, but the model object was not passed.

            How do I ensure both?

            Thanks,

            yan

            Comment

            Working...
            X