This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes [JSF 1.1] Asynchronous JSF Update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "[JSF 1.1] Asynchronous JSF Update" Watch "[JSF 1.1] Asynchronous JSF Update" New topic
Author

[JSF 1.1] Asynchronous JSF Update

Emmanuel BLONVIA
Greenhorn

Joined: Sep 25, 2007
Posts: 4
Hi there,
I am using jsf 1.1 (yes I know; please don't scold me. I am constrained to use this version for the moment).

Here is my problem :
I need to asynchronously update an area of my jsf page after an onchange (or on blur) event from an InputText.

I don't want the user to wait or click elsewhere for the update to be performed before he can keep on filling the form.
here is my jsp code (in a rich:dataTable)


And here is what the **performCalculationAndUpdate** looks like :




How can I make the calculation and update code asynchronous ?
Could someone help me ?

Thanks and best regards
Emmanuel B.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

Even in JSF2, that won't do what you want. Listeners are invoked when a form is submitted, not asynchronously.

To get asynchronous, you need an asynchronous support framework such as "Asynchronous JavaScript and XML" (AJAX). In order to update part of a web page without replacing the entire page in the display, you need "partial page update".

Unfortunately, AJAX support is not part of the core JSF 1.x implementations. It was available - and quite easy to use - via certain extension tagsets such as RichFaces and IceFaces, but not in JSF 1.x itself. For that, you need JSF2.

It's not that big a jump from JSF1 to JSF2, so you might want to consider it. Otherwise, you'll have to do AJAX by "brute force". Or you could include one of the AJAX-capable extension tagsets, but it's probably less work in the short run to simply move to JSF2.


Customer surveys are for companies who didn't pay proper attention to begin with.
Emmanuel BLONVIA
Greenhorn

Joined: Sep 25, 2007
Posts: 4
Tim Holloway wrote:
It's not that big a jump from JSF1 to JSF2, so you might want to consider it. Otherwise, you'll have to do AJAX by "brute force". Or you could include one of the AJAX-capable extension tagsets, but it's probably less work in the short run to simply move to JSF2.


Thanks for your answer. You're completely right. I know how to do that in JSF 2 but I joined my current customer 6 months ago, have been suggesting moving to JSF 2 so far but I am not the technical final decision maker on the projet.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

That comes under "you can pay now or pay later" heading I think.
kumar toomu
Greenhorn

Joined: Dec 29, 2011
Posts: 14
you can use richfaces ajax components to achieve this requirement...
import http://richfaces.org/a4j

you can use <a4j:support> component... here is the sample code... hope this helps...

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [JSF 1.1] Asynchronous JSF Update
 
Similar Threads
valuechangelistener - oldvalue is always null
JSF valuechangeListener not detecting a change for values entered manually in a text field.
Rich:Datatable rerendering problem
Make selection with h:selectOneMenu and redisplay the value in a h:outputText?
Help with ValueChangeListener!!!