在 Glassfish 上运行 Ajax4JSF(a4j 组件)
我正在尝试使用 JSF 2.0、Weld、JPA2 和 Maven 在 GlassFish V3 上构建 Java EE 6 应用程序。 现在我在运行简单的
时遇到问题。这是我的小例子的片段。当在输入文本中输入内容时,输出文本应该自动更新。但什么也没发生(在 Firefox 中没有,在 IE8 中也没有)。
<ui:composition
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
(...)>
<h:inputText value="#{personHome.message}">
<a4j:support event="onkeyup" reRender="repeater"/>
</h:inputText>
<h:outputText id="repeater" value="#{personHome.message}"/>
除了我的示例不起作用之外,我的问题还在于我并不真正了解我是否需要 JSF 实现(MyFaces、Richfaces、Primefaces 等)或不使用 a4j 元素。它是“内置”在 glassfish 中吗? 到目前为止,我认为 JSF 只需要以下依赖项:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
那么...我需要做什么才能让 Ajax4JSF 在 GlassFish 上的简单 Java EE 应用程序上运行?
I'm trying to build an Java EE 6-application on GlassFish V3, using JSF 2.0, Weld, JPA2 and Maven.
Now i'm having trouble getting a simple <a4j:support>
running. This is the fragment of my little example. When typing something into the inputtext, the outputtext should automatically be updated. But nothing happens (not in Firefox, not in IE8).
<ui:composition
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
(...)>
<h:inputText value="#{personHome.message}">
<a4j:support event="onkeyup" reRender="repeater"/>
</h:inputText>
<h:outputText id="repeater" value="#{personHome.message}"/>
Beside that my example doesn't work, my problem is also that i don't really understand if i need a JSF implementation (MyFaces, Richfaces, Primefaces etc.) or not to use a4j elements. Is it "built-in" in glassfish?
Until now, i only have the following dependencies i think i need in for JSF:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
So... what do i have to do to get Ajax4JSF running on a simple Java EE-App on GlassFish?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为 Java EE 6 服务器,GlassFish v3 附带 JSF 2.0 实现(Mojarra 2.0.2,即 RI)。
我还将 JSF 工件标记为
provided
。作为旁注,我要提到 JSF 2.0 使用
提供内置 Ajax 支持(受到 RichFaces 的
的启发) )。As a Java EE 6 server, GlassFish v3 ships with a JSF 2.0 implementation (Mojarra 2.0.2 which is the RI).
I would also flag the JSF artifacts as
provided
.As a side note, I'd mention that JSF 2.0 provides built in Ajax support using
<f:ajax>
(inspired by the<a4j:support>
from RichFaces).