File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF render continously Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF render continously" Watch "JSF render continously" New topic
Author

JSF render continously

eddy johns
Ranch Hand

Joined: Feb 16, 2010
Posts: 67
Hi all,

I'm new to JSF so excuse the newbie question.

I need to continuously update a text field with values that come from the server. The idea is similar to that of a clock, updating every one second (for example.) I was thinking I could use this tag:

<f:ajax render="serverData"/>

but with something like render-continuously, as in:

<f:ajax render-continuously="serverData"/>

but of course render-continuously doesn't exist...

So, how do you achieve this?

Thanks!

Eddy
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

Continuously is a bit much. It sounds more like you want to poll at one-second intervals.

I'm no expert on the new JSF2 ajax tag, but the JBoss RichFaces extension tagset includes a "poll" tag to handle stuff like that.


Customer surveys are for companies who didn't pay proper attention to begin with.
eddy johns
Ranch Hand

Joined: Feb 16, 2010
Posts: 67
Thanks, Tim.

I'm looking into the solution you're suggesting and I'm running into a problem.

The following code, from the tutorial on the web on this tag:

<hutputText id="txt_count" value="#{navBean.count}" />
<p:poll actionListener="#{navBean.increment}" interval="1000" update="txt_count" />

is in a

<f:view>
<h:form>

with the appropriate closing tags. But when I try to hit the page it generates a Property 'increment' not found on type com.roberts.ui.NavBean exception, and the page isn't rendered.

The increment method is there in the bean:

public void increment(ActionEvent actionEvent) {
count++;
}

What am I doing wrong? Any help would be greatly appreciated!
 
 
subject: JSF render continously