SpringMVC Redirect page using ParameterizableViewController


ParameterizableViewController

        Trivial controller that always returns a pre-configured view and optionally sets the response status code. The view and status can be configured using the provided configuration properties.

No need to write any Controller to handle request


Example
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
           http://www.springframework.org/schema/util 
           http://www.springframework.org/schema/util/spring-util-3.0.xsd  
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">
 
    <!-- ************************************************************* --> 
    
 
  
<!-- ************************************************************* --> 
 <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
     
     <property name="mappings">
         
         <props>
             
             <prop key="/parameterizableViewController.htm">welcomeController</prop>
             </props>
             
        </property>
    </bean>



<!-- ************************************************************* --> 

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    
	<property name="prefix">		    
			<value>/WEB-INF/pages/</value>
	</property>	
		
		
	<property name="suffix">
	 	<value>.jsp</value>
	</property>    
	    
</bean>

	<!-- ************************************************************* -->
	
<bean name="welcomeController" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
    
	<property name="viewName" value="page"/>
	
</bean>	

	<!-- ************************************************************* -->
	
</beans>

Screenshot
            

            

Download
        ParameterizableViewController maven zip
        ParameterizableViewController war




Comments


©candidjava.com