java - 特立尼达投票jsf

标签 java jsf trinidad

您好,我正在尝试使用 tr:poll 但没有成功。 我的 jspx 看起来像 inside body 标签,

<f:view>
<tr:document></tr:document>
<tr:form>

        <tr:poll id="poller" interval="500" pollListener="#{sessionScope.mainBean.polled}" ></tr:poll>
        <tr:outputText value="#{sessionScope.mainBean.count }" partialTriggers="poller"></tr:outputText>

</tr:form>

主 bean 看起来像

public class MainBean
{
private String user;
private int count = 0;

public MainBean(String user)
{
    this.user = user;
}

public void polled(org.apache.myfaces.trinidad.event.PollEvent poe)
{
    System.out.println(count + "polled by "+user);
    ++count;
}

public int getCount()
{
    return count;
}

但是轮询只被调用一次。

这里有什么问题吗?

编辑:

大家好

看来我太蹩脚了,我根本无法让 ppr 工作,别管 poll 了。 我在这里上传了存档的 eclipse 项目,我使用的是 JSF 2.0 和 trinidad 2.0,jSTL 1.2。 http://www.mediafire.com/?u35h0k65qh5ed71 它与上面描述的几乎相同。

最佳答案

首先,您的 tr:document 标签应该围绕整个文档:

<f:view> 
<tr:document>
   <tr:form>          
      <tr:pollid="poller"interval="500"
          pollListener="{sessionScope.mainBean.polled}">
      </tr:poll>         
      <tr:outputText 
         value="#{sessionScope.mainBean.count}" 
          partialTriggers="poller"></tr:outputText>
   </tr:form> 
</tr:document> 
</f:view>

再试一次。

关于java - 特立尼达投票jsf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7012448/

相关文章:

java - 禁用提交按钮以防止双击,但仅限于表单验证成功时

jsf - FacesMessage 未与 PPR 一起显示

java - Spring MVC - 在 View 中显示异常(JSP 页面)

java - org.hibernate.NonUniqueObjectException : A different object with the same identifier value was already associated with the session

java - 使用 Java 反射创建 eval() 方法

jsf - 使用复合组件将列添加到 Primefaces PanelGrid

java - jsf 特立尼达 : Change tr:table header

java - 检查字符串是否包含反斜杠?

jsf - 在 JSF 中单击按钮异步调用长时间运行的进程

css - Primefaces 日历不会重新调整其在窗口旋转时的位置