struts2 拦截器1

时间:2023-03-09 16:55:29
struts2 拦截器1

action invoke前会调用,invoke后会调用

public class FirstInterceptor extends AbstractInterceptor{

    @Override
public String intercept(ActionInvocation actionInvocation) throws Exception {
String result = actionInvocation.invoke();
return result;
} }
        <interceptors>
<interceptor name="firstInter" class="com.wolfgang.interceptor.FirstInterceptor"></interceptor>
</interceptors>
        <action name="testOGNL" class="com.wolfgang.action.TestOGNL">
<interceptor-ref name="firstInter"></interceptor-ref>
<result>/OGNL/static.jsp</result>
</action>