0

如何使用 primefaces 在我的 java ee 应用程序中仅更新网页的一部分?下面是我的xhtml代码:

        <h:form id="frm">

        <h:outputText value="#{equityBean.tdate}" id="mydt" style="position: absolute;right: 100px;top:210px"/>

            <p:panelGrid columns="3" style="position: absolute;top:210px">
                <p:selectOneMenu style="width: 150px" value="#{equityBean.exchange}">
                <f:selectItem itemLabel="NSE" itemValue="nse"/>
                <f:selectItem itemLabel="BSE" itemValue="bse"/> 
                <p:ajax update="sym" listener="#{equityBean.wow}"/>
                </p:selectOneMenu> 
                    <p:selectOneMenu style="width: 150px" id="sym" value="#{equityBean.scripSymbol}">
            <f:selectItem itemLabel="select scrip" />
            <f:selectItems var="scrip" value="#{equityBean.sl}"  itemLabel="#{scrip.scripSymbol}" itemValue="#{scrip.scripSymbol}"/>
        </p:selectOneMenu>
                    <p:commandButton value="Get Quote" type="submit" action="#{equityBean.setQuote()}" oncomplete="dlg.show()" update=":frmdialog" />
                    </p:panelGrid>
        <br/>
        <div style="width: 100%" id="updateDiv">

            <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>&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</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>&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</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>
            <hr/>



            </div>

我希望每 5 秒更新一次表格,我该怎么做?

4

0 回答 0