2016-11-08 94 views
0

我正在使用Maven工作struts2.5.5。元素類型「攔截器」的內容必須匹配「(param)*」

我在攔截器標籤錯誤:

元素類型"interceptor"的內容必須在struts.xml的文件匹配"(param)*"

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts PUBLIC 
    "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" 
    "http://struts.apache.org/dtds/struts-2.5.dtd"> 
<struts> 
    <package name="default" namespace="/action" extends="struts-default"> 
     <interceptors> 
     <interceptor name="authenticationInterceptor" class="AuthenticationInterceptor"> 
     <interceptor-stack name="secureStack"> 
      <interceptor-ref name="authenticationInterceptor"></interceptor-ref> 
      <interceptor-ref name="defaultStack"></interceptor-ref> 
     </interceptor-stack> 
     </interceptor> 
    </interceptors> 
    <action name="login"> 
     <result>login.jsp</result> 
    </action> 
    <action name="LoginAction" class="LoginAction"> 
     <result name="success" type="redirectAction"> 
     <param name="actionName">task</param> 
     <param name="namespace">/action</param> 
     </result> 
     <result name="input">login.jsp</result> 
    </action> 
    </package> 
</struts> 

回答

0

攔截元素未關閉:

<interceptor name="authenticationInterceptor" class="AuthenticationInterceptor"> 

因此它試圖將<interceptor-stack>聲明作爲正文,而他預計只有在該位置的<param>元素。

只是自我密切標籤:

<interceptor name="authenticationInterceptor" class="AuthenticationInterceptor" /> 
相關問題