zoukankan      html  css  js  c++  java
  • struts2 拦截器

    Stucts2 拦截器

    public class InterceptorDemo1 extends AbstractInterceptor{
    
    	@Override
    	public String intercept(ActionInvocation invocation) throws Exception {
    		System.out.println("拦截前");
    		String result = invocation.invoke();
    		
    		System.out.println("拦截 后");
    		return result;
    	}
    
    }
    

      

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    	<package name="main" extends="struts-default">
    		 <interceptors>
    		<interceptor name="interceptorTest1" class="InterceptorDemo1" ></interceptor>
    		<interceptor name="interceptorTest2" class="InterceptorDemo2" ></interceptor>
    		<interceptor name="loginCheckInterceptor" class="LoginCheckInterceptor"></interceptor>
    	   </interceptors> 
    		<action name="MyAction" class="MyAction">
    		<interceptor-ref name="interceptorTest1"></interceptor-ref>
    			<interceptor-ref name="interceptorTest2"></interceptor-ref> 
    			<result name="success">/index.jsp</result>
    		</action>
    		<action name="login" class="CustomerAction" method="login">
                <result>/login.jsp</result>
            </action>
    		
    	</package>
    	
    </struts>   
    

      

  • 相关阅读:
    North North West
    HDU-5387 Clock
    HDU-1036 Average is not Fast Enough!
    Growling Gears
    HDU-5375 Gray code
    HDU-5373 The shortest problem
    hdu-5364 Distribution money
    UVA
    HDU-5363 Key Set
    HDU-5326 Work
  • 原文地址:https://www.cnblogs.com/linlf03/p/5156969.html
Copyright © 2011-2022 走看看