Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seam's Javascript and AJAX support

 
Plamen Alexandrov
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have a question about integration of new-style Ajax in Javascript and MyFaces framework - note this is a Seam question (being an integration framework). Every time I start up a new WEB 2.0 project - being a Rich Internet Application - I end up writing a lot client side javascript code to improve user experience by both optimization and detailed customization. I'm now convinced that I have to do so - in order to meet certain client requirements. When it comes to Ajax most of the time I need a lot more detailed approach of updating a lot of different small DOM elements as a result of my ajax request, rather than just an area of generated html.

It is not a secret that having a client-side DOM update should always be backgrounded by a server-side update of MyFaces component tree in order to persist your changes after refresh. My question is - how do you achieve this behavior using Seam? I am acquainted of alternative to ASP .NET 3.5 JSON serialization technologies like DWR but I'm more interested on programmatic ease of this kind of updates on the server-side component tree. Another similar question is how do you keep authentication, authorization, long-lived application/request/business process/transaction context in a javascript based remote procedure call on your business method?

I'm not pretty sure that this is the best way to do ajax updates but definitely having only <AjaxZone> taggs is not an option to me.

Have any Ideas or Recommendations - don't doubt to share...
 
Jason Porter
Author
Ranch Hand
Posts: 126
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at RichFaces (http://www.jboss.org/jbossrichfaces/) or ICEfaces (http://www.icefaces.org). These are both JSF component kits, so they will require a JSF implementation (MyFaces or Sun RI). Both of these work nicely with Seam. Others have also had success with Oracle ADF now known as Apache Trinidad.
 
Dan Allen
Author
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want your Ajax request to result in an updated server-side tree and very fine-grained updates to the page, your best bet is ICEfaces. I like both RichFaces and ICEfaces, but ICEfaces is unique in that it uses a diffing algorithm to only make changes to the page that are actually changes. You don't need any of those "zone" tags because it automatically figures out what to update.

Another similar question is how do you keep authentication, authorization, long-lived application/request/business process/transaction context in a javascript based remote procedure call on your business method?


The beautiful part about using Ajax-based JSF components with Seam is that you don't do anything differently than you do with a non-Ajax application (talking in general terms). Seam doesn't really know that its components are being used over Ajax, so you can do all of your normal authentication, authorization, long-lived application/request/business process/transaction, stuff. The key is that you use a long-running conversation to keep state from one Ajax request to the next.

I cover this question a bit in chapter 7 and chapter 12 is totally dedicated to this topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic