• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
山高我为峰
博客园    首页    新随笔    联系   管理    订阅  订阅
Caused by: 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)"

Caused by: 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)"该错误的意思是:package的内容必须按

result-types

interceptors

default-interceptor-ref

default-action-ref

default-class-ref

global-results

global-exception-mappings

action*

这样的顺序放置

 

以下是struts.xml中的package的内容:

......
<package name="default" namespace="/" extends="struts-default"> <default-action-ref name="index" />
     <action name="index">
       <result>index.jsp</result>
     </action>
<global-results> <result name="error">/WEB-INF/pages/public/error.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="error" /> </global-exception-mappings> </package>
.....

解决办法:将action放置到如下位置就好了

    <package name="default" namespace="/" extends="struts-default">
        <default-action-ref name="index" />
        <global-results>
            <result name="error">/WEB-INF/pages/public/error.jsp</result>
        </global-results>
        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="error" />
        </global-exception-mappings>
        <action name="index">
            <result>index.jsp</result>
        </action>
    </package>

 

posted on 2016-02-19 10:38  山高我为峰  阅读(3339)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3