您好,我正在尝试使用 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/