<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="itcast" namespace="/" extends="struts-default"> <!-- Configure the interceptor element under the package element--> <interceptors> <!-- Fill in your own interceptor name and full class name --> <interceptor name="MyInterceptor" class="action.MyInterceptor"></interceptor> <!-- Define an interceptor stack --> <interceptor-stack name="mystack"> <interceptor-ref name="MyInterceptor"> <param name="excludeMethods">add,delete</param> <!-- This param represents a method that does not intercept --> </interceptor-ref> <!-- Note that the default interceptor stack of struts should be added, otherwise there will be no function of struts --> <interceptor-ref name="defaultStack"> <param name="includeMethods">method name, method name</param> <!-- This param represents the method of interception, note that it cannot appear under an interceptor element at the same time as excludeMethods--> </interceptor-ref> </interceptor-stack> </interceptors> <!-- Finally configure the default interceptor stack of the package to access all actions under the package will go through the interceptor--> <default-interceptor-ref name="mystack"></default-interceptor-ref> <action name="PersonAction_*" class="action.PersonAction" method="{1}"> <result name="success" type="redirect">/index.jsp</result> <result name="ognl" type="redirect" >/index.jsp</result> <result name="find" type="dispatcher" >/listperson.jsp</result> <result name="findAllPerson" type="dispatcher" >/listperson.jsp</result> </action> </package> </struts>
Configuration of interceptors in struts2 framework
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324590570&siteId=291194637
Ranking