使用 primefaces 高级主题时 faces-config.xml 和 primefaces-sentinel.taglib.xml 出错

Error with faces-config.xml and primefaces-sentinel.taglib.xml when using primefaces premium theme

我正在使用 Primefaces Premium 主题,我将必要的 jar 添加到它的类路径中,但遇到了一个我无法调试的错误,因为它似乎与 java 无关,但与 xml/jsf 相关

面孔-config.xml

Multiple annotations found at this line: - cvc-pattern-valid: Value 'primefaces-sentinel' is not facet-valid with respect to pattern '($|| \p{L})(\p{L}|\p{Nd}||$)*' for type 'null'. - cvc-complex-type.2.2: Element 'name' must have no element [children], and the value must be valid.

primefaces-sentinel.taglib.xml

cvc-complex-type.2.4.a: Invalid content was found starting with element 'description'. One of '{"http:// java.sun.com/xml/ns/javaee":handler-class, "http://java.sun.com/xml/ns/javaee":behavior, "http:// java.sun.com/xml/ns/javaee":component, "http://java.sun.com/xml/ns/javaee":converter, "http:// java.sun.com/xml/ns/javaee":validator, "http://java.sun.com/xml/ns/javaee":source}' is expected.

很遗憾,您没有显示导致问题的代码。所以它是根据错误信息猜测的。

faces-config.xml

Multiple annotations found at this line: - cvc-pattern-valid: Value 'primefaces-sentinel' is not facet-valid with respect to pattern '($|| \p{L})(\p{L}|\p{Nd}||$)*' for type 'null'. - cvc-complex-type.2.2: Element 'name' must have no element [children], and the value must be valid.

所以,您在 faces-config.xml 中有以下元素?

<name>primefaces-sentinel</name>

鉴于正则表达式模式 ($|| \p{L})(\p{L}|\p{Nd}||$)*,连字符在 <name> 元素中确实无效。

删除连字符或使用与给定模式匹配的不同名称:

<name>sentinel</name>

primefaces-sentinel.taglib.xml

cvc-complex-type.2.4.a: Invalid content was found starting with element 'description'. One of '{"http://java.sun.com/xml/ns/javaee":handler-class, "http://java.sun.com/xml/ns/javaee":behavior, "http://java.sun.com/xml/ns/javaee":component, "http://java.sun.com/xml/ns/javaee":converter, "http://java.sun.com/xml/ns/javaee":validator, "http://java.sun.com/xml/ns/javaee":source}' is expected.

预期元素列表中缺少 <tag-name>,所以您在 primefaces-sentinel.taglib.xml 中有以下顺序?

<tag>
    <tag-name>...</tag-name>
    <description>...</description>
    ...
</tag>

鉴于 XSD 文件中定义的预期元素顺序,这确实无效。

围绕它们交换:

<tag>
    <description>...</description>
    <tag-name>...</tag-name>
    ...
</tag>