我有一个显示来自雅虎财经的图表的应用程序,我希望每次在线更改图表时更新图表。下面是我的代码。
<table style="width: 100%">
<tr>
<td>
<b>Nifty 50</b><br/>
<b><h:outputText value="#{equityBean.niftyChange}"/></b><br/>
<b><h:outputText value="#{equityBean.niftyChangePer}"/></b><br/>
<b><h:outputText value="#{equityBean.niftyLTP}"/></b></td>
<td><img src="http://ichart.yahoo.com/t?s=^NSEI"/></td>
<td> </td><td> </td>
<td>
<b>BSE Sensex</b><br/>
<b><h:outputText value="#{equityBean.sensexChange}"/></b><br/>
<b><h:outputText value="#{equityBean.sensexChangePer}"/></b><br/>
<b><h:outputText value="#{equityBean.sensexLTP}"/></b></td>
<td><img src="http://ichart.yahoo.com/t?s=^BSESN"/></td>
<td> </td><td> </td>
<td>
<b>Gold</b><br/>
<b><h:outputText value="#{equityBean.sensexChange}"/></b><br/>
<b><h:outputText value="#{equityBean.sensexChangePer}"/></b><br/>
<b><h:outputText value="#{equityBean.sensexLTP}"/></b></td>
<td><img src="http://ichart.yahoo.com/t?s=GCQ12.CMX"/></td>
</tr>
</table>
我怎么用 p:ajax 做呢?或者除了调度程序之外还有其他方式吗? 已编辑
<p:poll interval="3"
listener="#{equityBean.sensexChange}" update=":frm" />
frm 是表单的 id,我在表单中显示了日期,但它没有更新
<h:form id="frm">
<h:outputText value="#{equityBean.tdate}"/>
再次编辑:
public String getSensexChange() {
setIndex("^BSESN");
return sensexChange;
}