在 Glassfish 上运行 Ajax4JSF(a4j 组件)

发布于 2024-09-02 22:09:37 字数 1285 浏览 4 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清泪尽 2024-09-09 22:09:37

(...)它是“内置”在 glassfish 中吗?

作为 Java EE 6 服务器,GlassFish v3 附带 JSF 2.0 实现(Mojarra 2.0.2,即 RI)。

到目前为止,我认为 JSF 只需要以下依赖项 (...)

我还将 JSF 工件标记为 provided

作为旁注,我要提到 JSF 2.0 使用 提供内置 Ajax 支持(受到 RichFaces 的 的启发) )。

(...) Is it "built-in" in glassfish?

As a Java EE 6 server, GlassFish v3 ships with a JSF 2.0 implementation (Mojarra 2.0.2 which is the RI).

Until now, i only have the following dependencies i think i need in for JSF (...)

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文