Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
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: 17145
    
  27

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.


An IDE is no substitute for an Intelligent Developer.
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: 17145
    
  27

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
 
jQuery in Action, 3rd edition