来自http://xmlns.jcp.org命名空间的标签无法呈现,而http://java.sun.com/jsf可以正常工作 [英] Tags from http://xmlns.jcp.org namespace do not render, while http://java.sun.com/jsf work fine

查看:279
本文介绍了来自http://xmlns.jcp.org命名空间的标签无法呈现,而http://java.sun.com/jsf可以正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个:

<html 
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
>
<h:selectOneRadio>
    <f:selectItem value="1" itemValue="1" itemLabel="123"/>
    <f:selectItem value="2" itemValue="2" itemLabel="321"/>
</h:selectOneRadio>

我明白了:

<f:selectItem value="1" itemValue="1" itemLabel="123"></f:selectItem>
<f:selectItem value="2" itemValue="2" itemLabel="321"></f:selectItem>
<select name="j_idt5" size="1"></select>

为什么不呈现xmlns:f="http://xmlns.jcp.org/jsf/core"标签?

我正在Netbeans 7.3上使用JBoss AS 7.

I'm using JBoss AS 7 on Netbeans 7.3.

推荐答案

JSF 2.2中引入了JSF taglib URI中的新XML名称空间域http://xmlns.jcp.org,它是Java EE 7的一部分.JBossAS 7作为Java EE兼容6的应用程序服务器不附带捆绑的JSF 2.2,而是附带JSF 2.1.因此,新的XML名称空间域根本不起作用.而且,新的JSF 2.2特定功能(例如,直通元素和属性)根本无法使用.

The new XML namespace domain http://xmlns.jcp.org in JSF taglib URIs is introduced in JSF 2.2 which is part of Java EE 7. JBoss AS 7 as being a Java EE 6 compliant application server does not ship with JSF 2.2 bundled, but with JSF 2.1. Therefore the new XML namespace domain does not work at all. Also the new JSF 2.2 specific features such as passthrough elements and attributes won't work at all.

您需要使用与JSF 2.1兼容的XML名称空间域http://java.sun.com.这是完整的设置:

You need to use the JSF 2.1 compatible XML namespace domain http://java.sun.com. Here's the complete set:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
>

我不确定您为什么尝试使用新的JSF 2.2 XML名称空间.也许您错误地阅读了针对JSF 2.2的教程(例如 Oracle Java EE 7教程)而不是以JSF 2.0/2.1为目标的对象(例如 Oracle Java EE 6教程).请仔细注意版本是否匹配.

I'm not sure why you attempted to use the new JSF 2.2 XML namespaces. Perhaps you incorrectly read a JSF 2.2 targeted tutorial (e.g. Oracle Java EE 7 tutorial) instead of a JSF 2.0/2.1 targeted one (e.g. Oracle Java EE 6 tutorial). Pay carefully attention that the versions match.

如果您确实打算在JBoss服务器上使用JSF 2.2,则基本上应该将旧的JBoss AS 7升级到与Java EE 7兼容的后继产品 WildFly 8 .或者,按照此处的说明,将JBoss AS 7的捆绑JSF库手动升级到较新的版本:

If you really intend to use JSF 2.2 on a JBoss server, then you should basically be upgrading the old JBoss AS 7 to its Java EE 7 compatible successor WildFly 8. Alternatively, manually upgrade the bundled JSF libraries of JBoss AS 7 to a newer version as instructed here: Upgrade JSF / Mojarra in JBoss AS / EAP / WildFly.

这篇关于来自http://xmlns.jcp.org命名空间的标签无法呈现,而http://java.sun.com/jsf可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆