This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Integrating AJAX and JSF" Watch "Integrating AJAX and JSF" New topic
Author

Integrating AJAX and JSF

Kevin Weisser
Greenhorn

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?

Regards,

Kevin
James McCluskey
Greenhorn

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.

 
Consider Paul's rocket mass heater.
 
subject: Integrating AJAX and JSF
 
Similar Threads
AJAX, JSF and security
MVC Model and Domain Model
Creating a custom scope... (kinda long)
AJAX and PhaseListener
Where to put initialization code?