2013年10月22日星期二

struts2 how custom interceptor

Write a struts2 + spring project you want to customize an interceptor verify the account login
<?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="pwb-default" extends="struts-default">
     <interceptors>
     <interceptor name="login" class="interceptor.LoginInterceptor"/>
     <interceptor-stack name="loginStack">
     <interceptor-ref name="login"></interceptor-ref>
     <interceptor-ref name="defaultStack"></interceptor-ref>
     </interceptor-stack>
     </interceptors>
     <global-results>
     <result name="login">/main/login.html</result>
     </global-results>
     <default-interceptor-ref name="loginStack"/>
    </package>
</struts>


will be reported The content of element type "package" must match "(result-types?, interceptors?, default-interceptor-ref?, default-action-
ref?, default-class-ref?, global-results?, global-exception-mappings?, action *) ".
error how to solve ah ? Much they seek to rescue
------ Solution ------------------------------------ --------
put in the wrong order ah.
he content of element type "package" must match "(result-types?, interceptors?, default-interceptor-ref?, default-action-
ref?, default-class-ref?, global-results?, global-exception-mappings?, action *) "
error message obviously friends.
------ For reference only -------------------------------------- -

dare to ask how to change it ?
------ For reference only -------------------------------------- -
result-types?,
interceptors?,
default-interceptor-ref?,
default-action-ref?,
default-class-ref?,
global-results?,
global-exception-mappings?,
action *

will be arranged in this order does not ?
------ For reference only -------------------------------------- -

Well get out Thank you, illustrated

没有评论:

发表评论