Forums Register Login

JSF render continously

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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:

<h:outputText 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!
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1337 times.
Similar Threads
Ajax support in Jsf 2.0
if's and while's spinning in my head.
Execute Javascript-Code after f:ajax render
Can we assign JSF Ajax Render attribute dynamically?
Ajax listener method is not fire for other(except first) component
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:24:23.