The content of element type "package" must match "(result-types?,interceptors?,default-intercept .

在編寫後臺登陸模塊時,將許多默認的設置放在一個名爲default的package
裏。然後再定義其他package繼承該包。之前我的struts.xml配置如下
<struts>
    <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    <constant name="struts.devMode" value="true" />
   
    <package name="exam_default" extends="struts-default" namespace="/">
        <!--自定義攔截器及攔截器棧-->
        <interceptors>
            <!--用戶認證攔截器-->
            <interceptor name="authentication" class="action.admin.AuthenticationInterceptor"/>
             <!--用戶認證攔截器棧,用於防止用戶非法訪問-->
            <interceptor-stack name="user" >
                <interceptor-ref name="authentication" />
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
            <interceptor-stack name="guest" >
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
        </interceptors>
        <!--全局異常映射-->
        <global-exception-mappings>
            <exception-mapping result="error" exception="java.lang.Exception"/>
        </global-exception-mappings>
       <!--全局result-->
        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>
    </package>
   
    <package name="admin" extends="exam_default" namespace="/admin">
        <action name="login" class="login">
            <result type="redirectAction">index</result>
      
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章