Results 1 to 6 of 6

Thread: classes/views.properties

  1. #1
    Join Date
    Apr 2005
    Location
    Porto Alegre, BR
    Posts
    6

    Default 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. #2
    Join Date
    Jan 2005
    Location
    MD
    Posts
    31

    Default

    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.

  3. #3

    Default

    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

  4. #4
    Join Date
    Apr 2005
    Location
    Porto Alegre, BR
    Posts
    6

    Default

    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

  5. #5

    Default

    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

  6. #6

    Default 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •