【问题标题】:The content of element type "interceptor" must match "(param)*"元素类型“interceptor”的内容必须匹配“(param)*”
【发布时间】:2017-03-22 01:45:49
【问题描述】:

我正在使用 Maven 工作 struts2.5.5。

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

元素类型"interceptor"的内容必须匹配"(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>

【问题讨论】:

    标签: xml configuration struts2 interceptor dtd


    【解决方案1】:

    拦截器元素未关闭:

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

    因此它试图将&lt;interceptor-stack&gt; 声明作为主体,而他只希望&lt;param&gt; 元素处于该位置。

    只需自行关闭标签:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-10
      • 2015-06-26
      • 2017-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多