相关文章

更多

最近更新

更多

The content of element type "package" must match "...

2019-03-25 13:38|来源: 网路

在编写后台登陆模块时,将许多默认的设置放在一个名为default的package
里。然后再定义其他package继承该包。之前我的struts.xml配置如下
<struts>
    <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
    <constant name="struts.devMode" value="true" />
   
    <package name="exam_default" extends="struts-default" namespace="/">
        <!--自定义拦截器及拦截器栈-->
        <interceptors>
            <!--用户认证拦截器-->
            <interceptor name="authentication" class="action.admin.AuthenticationInterceptor"/>
             <!--用户认证拦截器栈,用于防止用户非法访问-->
            <interceptor-stack name="user" >
                <interceptor-ref name="authentication" />
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
            <interceptor-stack name="guest" >
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
        </interceptors>
        <!--全局异常映射-->
        <global-exception-mappings>
            <exception-mapping result="error" exception="java.lang.Exception"/>
        </global-exception-mappings>
       <!--全局result-->
        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>
    </package>
   
    <package name="admin" extends="exam_default" namespace="/admin">
        <action name="login" class="login">
            <result type="redirectAction">index</result>
        </action>
        <action name="index">
            <result>index.jsp</result>
        </action>
    </package>
</struts>
      各位,谁看出来这哪里错了吗??反正最开始我是没看出来。一运行程
序来个错误。
“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*)". ”
刚看到这个错误我就想,哪个也没写错呀。仔细对了好几遍也没发现哪个属
性写错了。最后Google了一下,看了别人写的文章豁然开朗了。

     这个错误的意思是,package里元素必须按照一定的顺序排列。这个顺序
就是
result-types
interceptors
default-interceptor-ref
default-action-ref
default-class-ref
global-results
global-exception-mappings
action*(就是所有的action放到最后)

 
问题补充:
鄙视javaeye的版主,

六月下雪了。

我的博客被移到了问答,严重怀疑管理的IQ.

相关问答

更多
  • 可以选择转义双引号: test("Steve said ", "\"hello world\""); 或者您可以使用单引号: test("Steve said ", '"hello world"'); There's the option of escaping the double quotes: test("Steve said ", "\"hello world\""); or you can use single quotes: test("Steve said ", '"hello worl ...
  • 大概你有一个变量,并使用JSON.parse(data); 。 在这种情况下,使用: JSON.parse(data.replace(/"/g,'"')); 您可能希望修复您的JSON编写脚本,因为" 在JSON对象中无效。 Presumably you have it in a variable and are using JSON.parse(data);. In which case, use: JSON.parse(data.replace(/"/g,'"')); ...
  • 我结束了使用: data: <%= @product_count.to_json.html_safe %> 我试过h和raw ,但html_safe没有工作,但是, html_safe做到了。 不知道为什么,但对于未来的旅行者我在轨道版本3.2.7。 I ended up using: data: <%= @product_count.to_json.html_safe %> I tried both h and raw and neither of those worked, however, html_ ...
  • 答案是根据规范它实际上并不需要任何转义(跳过CDATA的提及): &符号(&)和左尖括号(<) 不得以其字面形式出现(...)如果在别处需要它们,则必须使用数字字符引用或字符串" & "和" < "转义" < " 。 右尖括号(>) 可以使用字符串" > " (...) 为了允许属性值包含单引号和双引号,撇号或单引号字符(')可以表示为" ' " ,而双引号字符(“)表示为" " " " " " 。 您可以使用createTextNode()轻松验证这 ...
  • 是"仅"表示单引号。 Yes " signifies single quotes only.
  • 这里的问题是你没有使用html_safe 。 你的昵称字段为空,并在csv文件中转换为"" ,但它被认为是不安全的Rails和HTML转义。 只需在结果上调用html_safe : <%= response.content_type = 'application/octet-stream' CSV.generate do |csv| @persons.each do |person| csv << [ person[:name], person[:nickname] ] end end .h ...
  • (由于stackoverflow注释限制为264个字符,因此在此处发布) @wangyiran 我无法重现。 这是我的测试: public class Toto { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } 然后 @Test ...
  • 您不需要在元素中对引号进行编码,仅在属性中进行编码。 所以: DBName "xyz" 是不必要的,你可以使用: DBName "xyz" 似乎XmlDocument.Load()理解你在一个元素中不必要地放置编码引号(“)”时的含义,默认情况下XmDocument.Save()用未编码的引号(“)替换它们。 如果您的来源是:您将注意到完全相同的行为:
  • 这是我如何解决它。 问题是所有浏览器都自动解码“ 迹象。 所以我修复了Ext doFormUpload函数,如下所示: doFormUpload : function(o, ps, url){ ... try{ doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document; if(doc){ ...
  • Excel列不是普通数字系统。 这不仅仅是基数26.第一个两位数的列是“AA”。 在任何正常数字系统中,前两位数字由两个不同的数字组成。 基本上,在excel列编号中,没有“零”数字。 为了解释这种差异,在每次迭代时减去1。 Excel columns aren't a normal number system. It's not just base 26. The first two-digit column is "AA". In any normal number system, the first ...