• Post Reply Bookmark Topic Watch Topic
  • New Topic

a4j:keepalive  RSS feed

 
Bishal Ghimire
Greenhorn
Posts: 26
Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to gather the experience of you all with the use of <a4j:keepalive bean..>. I am getting surprising behavior with the use of it. I am at this point where if I don't use it, certain parts of the page don't work, and if I use it, some other parts don't work.

Like to hear experience (sugggestions/alternatives/pros/cons) from you all.

Thanks!
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you'd probably get the same basic behavior without having to do the tricks with a4j:keepalive by using View Scope in JSF2.
 
Bishal Ghimire
Greenhorn
Posts: 26
Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tim. But i am sorry that I forgot to mention I am using JSF 1.2. And, there is no ViewScope in it.
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A managed bean with request scope will be instantiated when needed to service a new request. That's great when you're using regular HTTP requests. Even with most AJAX requests that should be fine. Let's say you have a choice control that lets you pick a U.S. state, and that sends an AJAX request to get a list of cities. When you pick a city and submit the whole form, a new managed bean is created and both the state and city are set to it.

Sometimes however, you have a more complicated application, or ... as the case may be ... one designed by monkeys. You may want managed beans that had properties set by an AJAX request to stick around until you submit the whole form. That's what a4j:keepalive does for you. My non-expert advice is to stay away from it if possible, but keep it in your toolkit.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!