users@woodstock.java.net

Re: Asynchronously submit and refresh. How to?

From: Dmitry Kushner <Dmitry.Kushner_at_Sun.COM>
Date: Tue, 20 May 2008 11:55:10 -0600
Stefan,


Stefan Bley wrote:
Hi Arnaud,

thanks for your reply.

I tried as you suggested. The event is triggered, but the values from cal1
and txt1 are not stored in the Bean's properties. I verify this through a
logging call in the event handler. :confused:

  
make sure that you don't have validation or other constrains turned on on the text field. If field is not validated, JSF will not commit the data to the bean.
Otherwise, this is a correct approach.
Furthermore, how could I make refresh 2 components, say dd2 and dd3?

  
If you want to supply none of the additional code you have to make them refresh independently. Alternatively, you can provide your own listener to refresh events, and bundle refresh calls, but this involves writing some javascript. You can see examples in woodstock/javascript/.../widget/_jsfx/
Cheers, Stevy


Arnaud Brand wrote:
  
Instead using 

dd1.submit("form1:cal1,form1:txt1");
dd2.refresh("form1:dd1"); 
I would rather try 
dd2.refresh("form1:dd1,form1:cal1,form1:txt1"); 
This should submit dd1, cal1 and txt1, trigger your event listener and
refresh dd2. 

2 reasons for that : 
- if your bean "Bean" is scoped at the request level your second call
(dd2.refresh) will have "lost" the values from your first call
(dd1.submit). 
- it might be that dd2.refresh is called before dd1.submit actually
returns (because submit is asynchronous), so may be your dd2 values are
set in the bean after having already been read by dd2.refresh. 

I hope that helps. Have a nice evening, 
Arnaud