jQuery in Action, 3rd edition
The moose likes JSF and the fly likes Integrating AJAX and JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Integrating AJAX and JSF" Watch "Integrating AJAX and JSF" New topic

Integrating AJAX and JSF

Kevin Weisser

Joined: Aug 24, 2007
Posts: 2
I've seen a few examples out showing how to either integrate AJAX using a PhaseListener approach, and also how to integrate AJAX using IBM/JSF implementation that allows you specify panels to be updatable via AJAX.

The example I'm trying to work through is where a user enters some key piece of information into a form, and that data is then used to query the database and populate other fields on the form.

The PhaseListener approach doesn't seem to make easy use of the Java bean, and it's functionality. However, it does give the user a single point of entry to get all of the data and return it as a JSON object at which point the HTML can be updated.

The second approach doesn't seem doesn't seem to allow the individual components on the form to be tied to the Java bean, because any values which may be prepopulated have to be individual function calls. This would be a ton of overhead if you had to make 10 calls to get the values for 10 compenents. However this approach does keep everything within JSF, and allows for minimal java scripting.

Does anyone have any additional suggestions/recommendations on performing an autofill type feature within JSF?


James McCluskey

Joined: Aug 23, 2007
Posts: 10
Have you tried Ajax4JSF? I'm not sure if it will meet your requirements exactly, but it enables you to make an Ajax call from a standard JSF component, and you simply identify the component to rerender when the response is received. Trivial access to the bean data therefore.

I hate anything in JSF where I have to pull apart the lifecycle and apply phase listeners.

I agree. Here's the link: http://aspose.com/file-tools
subject: Integrating AJAX and JSF
It's not a secret anymore!