`

MVC-2

阅读更多

1: UrlHandlerMapping(BeanNameUrlHandlerMapping)

<bean id="handlerMapping" class="org.
springframework.Web.servlet.handler.
SimpleUrlHandlerMapping">  

    <property name="order" value="1"/>  

    <property name="mappings">  

        <value>  

                ...  

        </value>  

    </property>  

</bean>  

 

<bean id="defaultHandlerMapping" ?  

class="org.springframework.Web.servlet.
handler.BeanNameUrlHandlerMapping"
>  

</bean> 

2:Controller

controller

使用MultiActionController

MultiActionController --> MethodNameResolver

1:继承MultiActionController;

2:为MultiActionController提供一个委派对象。

<bean name="/groupAdmin.do" ?  

class="org.springframework.Web.servlet.mvc.
multiaction.MultiActionController"
>  

    <property name="delegate" ref="groupAdminDelegate"/>  

    <property name="methodNameResolver" ref="
methodNameResolver"
/>  

</bean>  

 

<bean id="methodNameResolver" ?  

class="org.springframework.Web.servlet.mvc.
multiaction.ParameterMethodNameResolver"
>  

    <property name="methodParamNames" value="create,update,delete"/>  

    <property name="defaultMethodName" value="list"></property>  

</bean>  

 

<bean id="groupAdminDelegate" class="cn.spring21.
simplefx.controllers.GroupAdminDelegate"
>  

    <property name="groupAdminService" ref="groupAdminService"/>  

    <property name="listViewName" value="groupAdmin"/>  

    <property name="createViewName" value="redirect:createGroup.do"/>  

    <property name="updateViewName" value="redirect:updateGroup.do"/>  

    <property name="deleteSuccessViewName" 
value=
"redirect:groupAdmin.do"/>  

</bean> 

3: ViewResolver

InternalResourceViewResolver

BeanNameViewResolver

XmlFileViewResolver

ResourceBundleViewResolver

4: 映射请求到MultiActionController的method

InternalPathMethodNameResolver(Default)

ParameterMethodNameResolver

PropertiesMethodNameResolver

5:一次性控制器

6: 处理异常

SimpleMappingExceptionResolver

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics