ajax - JSF render data table content from managed-bean? -


i'm using richfaces develop web pages, datatable try display data information remote server. quite slow load data in 1 time, use cache store data, firstly cache empty , data table empty.

the ideal goal loading 1 row server(let 1mins each row) , store cache, append data table's end, question how can render content of data table managedbean once retrieve new data cache?

i use timer update cache values server during fixed period (1hour), means later, new data added cache, , old data removed cache, depend on server's latest data. same question when fresh cache , need rerender data table content according cache values.

thanks,

the easy way rerendering table. there 2 approaches using richfaces library:

client side

the a4j:poll component defines way periodically poll server in order trigger state changes, or update parts of page. uses timer trigger each n milliseconds.

you can use check cache data on server , rerender table.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"     xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"     xmlns:rich="http://richfaces.org/rich">     <h:form>         <a4j:poll id="poll" interval="2000" enabled="#{pollbean.pollenabled}" render="poll,grid" />     </h:form>      <h:form>         <h:panelgrid columns="2" width="80%" id="grid">             <h:panelgrid columns="1">                      <h:outputtext value="polling inactive" rendered="#{not pollbean.pollenabled}"></h:outputtext>                      <h:outputtext value="polling active" rendered="#{pollbean.pollenabled}"></h:outputtext>                      <a4j:commandbutton style="width:120px" id="control" value="#{pollbean.pollenabled?'stop':'start'} polling"                     render="poll, grid">                     <a4j:param name="polling" value="#{!pollbean.pollenabled}" assignto="#{pollbean.pollenabled}" />                 </a4j:commandbutton>                  </h:panelgrid>                  <h:outputtext id="serverdate" style="font-size:16px" value="server date: #{pollbean.date}" />         </h:panelgrid>     </h:form> </ui:composition> 

more information on richfaces a4j:poll.

server side

the a4j:push works consumer/producer architecture, uses no timer, instead uses message instruct client re-render part of page.

using component able have impact on client side (rerender html) java methods in managedbean. maybe problem here communicate current cache architecture jsf managed bean.

more information on richfaces a4j:push.

regards,


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -