struts2_大纲05_拦截器

1,interceptor原理,执行过程


2,创建一个interceptor,实现interceptor接口


3.重写三个方法: init()
      destroy()
      intercept(ActionInvocation arg0)
4.struts.xml文件中进行配置例如:
<struts>
<package name="struts" extends="struts-default">
<interceptors>
<interceptor name="proInterceptor" class="com.softeem.action.ProIntercept"></interceptor>
<interceptor-stack name="roleIntercept">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="proInterceptor"></interceptor-ref>
</interceptor-stack>
</interceptors>

<action name="loginAction" class="com.softeem.action.LoginAction">
<result type="chain">managerAction</result>
</action>

<action name="managerAction" class="com.softeem.action.ManageAction">
<interceptor-ref name="roleIntercept"></interceptor-ref>
<result>/success.jsp</result>
</action>
</package>
</struts>    



你可能感兴趣的:(struts2_大纲05_拦截器)