Announcement Announcement Module
Collapse
No announcement yet.
Problem mixing ViewResolver's Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem mixing ViewResolver's

    Hi,

    I wan to have JSP and PDF output in my webapplication. I can get both seperate but not together, depending on my *-servlet.xml contents. With this I get my JSP views correctly:

    Code:
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
        <property name="basename"><value>views</value></property>
        <property name="defaultParentView"><value>defaultViewResolver</value></property>
    	</bean>
    
    	<bean id="defaultViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
    		<property name="prefix"><value>/</value></property>
    		<property name="suffix"><value>.jsp</value></property>
    	</bean>
    but my pdf does not work. If I only have the ResourceBundleViewResolver, then my pdf works, but my jsp's not (since I don't define my jsp's in views.properties). I want to specify in my views.properties everything for pdf's and for jsp's I want the "defaultViewResolver" to work.

    Any help is much appriciated!

  • #2
    Re: Problem mixing ViewResolver's

    Originally posted by fester
    Code:
    <property name="defaultParentView"><value>defaultViewResolver</value></property>
    the defaultParentView refers to a view, NOT a viewResolver. This is probably your problem. Try removing it and see what happens.

    If that fails, can you post relevant parts of the stack trace?

    Regards,

    Comment


    • #3
      this is my views.properties
      Code:
      defaultViewResolver.class=org.springframework.web.servlet.view.InternalResourceViewResolver
      defaultViewResolver.viewClass=org.springframework.web.servlet.view.JstlView
      defaultViewResolver.prefix=/
      defaultViewResolver.suffix=.jsp
      
      displayTypeListPdf.class=org.appfuse.pdf.DisplayTypeListPdf
      I get following stacktrace when trying to access 'displayTypes.html'

      Code:
      javax.servlet.ServletException&#58; Could not resolve view with name 'displayTypeList' in servlet with name 'action'
      	at org.springframework.web.servlet.DispatcherServlet.render&#40;DispatcherServlet.java&#58;618&#41;
      	at org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;523&#41;
      	at org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;342&#41;
      	at org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;318&#41;
      displayTypes.html is mapped to the controller displayTypeController, which returns a ModelAndView( "displayTypeList" ....)

      This should normally then map onto /displayTypeList.jsp

      hopefully you can make sense out of this. Thank you for taking the time!

      Comment

      Working...
      X