元素类型 "interceptor" 的内容必须匹配 "(param)*"

The content of element type "interceptor" must match "(param)*"

我正在 struts2.5.5 使用 Maven。

我在拦截器标签中遇到错误:

The content of element type "interceptor" must match "(param)*"

在 struts.xml 文件中:

<?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>

拦截器元素未关闭:

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

因此它试图将 <interceptor-stack> 声明作为主体,而他只希望该位置的 <param> 元素。

自行关闭标签:

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