Results 1 to 10 of 33

Thread: Controller picks up call to ViewResolver

Threaded View

  1. #1
    Join Date
    Jan 2006
    Location
    Rotterdam, Netherlands
    Posts
    17

    Default Controller picks up call to ViewResolver

    Hello,

    I have exactly 1 Controller that I want to pick up any request. Since I want to put information in the URL (as opposed to parameters), and I want to be able to start this info from the root (eg http://hostname/info/moreinfo/...), I came up with the following mapping:

    Code:
    <bean name="showCategoryController" class="favorites.www.ShowCategoryController">
    	<property name="bookmarkService" ref="bookmarkService"/>
    </bean>
    	
    <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    	<property name="mappings">
    		<props>
    			<prop key="/*">showCategoryController</prop>
    		</props>
    	</property>
    </bean>
    	
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    	<property name="prefix">
    		<value>/WEB-INF/jsp/</value>
    	</property>
    	<property name="suffix">
    		<value>.jsp</value>
    	</property>
    	<property name="viewClass">
    		<value>org.springframework.web.servlet.view.JstlView</value>
    	</property>
    </bean>
    The problem is, that when I want to show a View, it is again picked up by the Controller (since it matches /*). How can I avoid this? Is this behaviour at all desirable? I would think that by the time you decide to show a View, you are beyond matching Controllers.

    Jeroen
    Last edited by Jeroen Kransen; Feb 3rd, 2006 at 07:50 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
  •