Results 1 to 3 of 3

Thread: Problem mixing ViewResolver's

  1. #1
    Join Date
    Aug 2004
    Posts
    21

    Default 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. #2
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default Re: Problem mixing ViewResolver's

    Quote 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,
    Darren Davison.
    Public Key: 0xE855B3EA

  3. #3
    Join Date
    Aug 2004
    Posts
    21

    Default

    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!

Similar Threads

  1. Mixing views problem
    By acho_vt in forum Web
    Replies: 2
    Last Post: Apr 28th, 2008, 11:16 AM
  2. Replies: 1
    Last Post: Jul 5th, 2005, 03:48 AM
  3. pagination and continuation problem in SWF
    By yfmoan in forum Web Flow
    Replies: 6
    Last Post: Jun 29th, 2005, 03:42 AM
  4. Replies: 0
    Last Post: Feb 16th, 2005, 01:45 PM
  5. Lazy Load Problem when Doing UnitTest
    By yoshi in forum Data
    Replies: 7
    Last Post: Sep 29th, 2004, 10:00 AM

Posting Permissions

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