struts.xml配置package报如下错误
Thecontentofelementtype"package"mustmatch"(result-types?,interceptors?,default-interc...
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*)".
这是我的配置文件
<struts>
<package name="com.etp" namespace="/" extends="struts-default">
<action name="login" class="com.etp.LoginAction" method="toPage">
<result name="loginSuccess">/jsp/success.jsp</result>
<result name="loginFailure">/jsp/failure.jsp</result>
<!--使用此拦截器 -->
<interceptor-ref name="mydefault" />
</action>
<action name="register" class="com.etp.RegisterAction" >
<result name="Done">/jsp/index.jsp</result>
</action>
<interceptors>
<interceptor name="aaaaa" class="com.etp.interceptor.LoginInterceptor">
</interceptor>
<!--拦截器栈 -->
<interceptor-stack name="mydefault">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="aaaaa"/>
</interceptor-stack>
</interceptors>
<!--定义全局Result -->
<global-results>
<!--当返回login视图名时,转入/login.jsp页面 -->
<result name="input">/index.jsp</result>
</global-results>
</package>
</struts> 展开
这是我的配置文件
<struts>
<package name="com.etp" namespace="/" extends="struts-default">
<action name="login" class="com.etp.LoginAction" method="toPage">
<result name="loginSuccess">/jsp/success.jsp</result>
<result name="loginFailure">/jsp/failure.jsp</result>
<!--使用此拦截器 -->
<interceptor-ref name="mydefault" />
</action>
<action name="register" class="com.etp.RegisterAction" >
<result name="Done">/jsp/index.jsp</result>
</action>
<interceptors>
<interceptor name="aaaaa" class="com.etp.interceptor.LoginInterceptor">
</interceptor>
<!--拦截器栈 -->
<interceptor-stack name="mydefault">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="aaaaa"/>
</interceptor-stack>
</interceptors>
<!--定义全局Result -->
<global-results>
<!--当返回login视图名时,转入/login.jsp页面 -->
<result name="input">/index.jsp</result>
</global-results>
</package>
</struts> 展开
1个回答
展开全部
是顺序的问题,在struts.xml里的package必须按一定的顺序
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*)".
这里写了,比如result-types?,interceptors?的意思就是
result-types 和interceptors都是可有可无但有的情况下必须是result-types在interceptors前面,你对比一下看看
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*)".
这里写了,比如result-types?,interceptors?的意思就是
result-types 和interceptors都是可有可无但有的情况下必须是result-types在interceptors前面,你对比一下看看
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询