web之家  
  1、Spring MVC bean的nameurl处理映射

 


<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean> <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/> <bean name="/home.html" class="com.yiibai.springmvc.UserController" />

2、
Spring MVC控制器类名称处理映射
 
 <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/WEB-INF/jsp/"/>
      <property name="suffix" value=".jsp"/>
   </bean>

   <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>

   <bean class="com.yiibai.springmvc.HelloController" />

   <bean class="com.yiibai.springmvc.WelcomeController"/>

3、Spring MVC简单URL处理程序映射
 <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/WEB-INF/jsp/"/>
      <property name="suffix" value=".jsp"/>
   </bean>

   <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
      <property name="mappings">
         <props>
            <prop key="/welcome.html">welcomeController</prop>           
            <prop key="/helloWorld.html">helloController</prop>
         </props>
      </property>
   </bean>

   <bean id="helloController" class="com.yiibai.springmvc.HelloController" />

   <bean id="welcomeController" class="com.yiibai.springmvc.WelcomeController"/> 
 controller类要继承AbstractController
 
posted on 2017-09-19 11:28  路修远而求索  阅读(681)  评论(0编辑  收藏  举报