Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

16.3. AJAX Buttons

Ajax4jsf can turn any JSF commandButon or commandLink operation into an AJAX operation. The AJAX buttons or links submit the form via a JavaScript call and rerender specified components on the page based on new back-end state after the server-side JSF event-handler method for the button is invoked.

To demonstrate this feature, let’s AJAX-enable the delete buttons in the data table for fans. When you click on any of those buttons, the current fan is removed from the database and the dataTable component is rerendered to reflect the change. But the page update is done in AJAX fashion: No page reload occurs. That is especially useful when you have a very long dataTable. A whole page refresh would have lost the current scrollbar position, and you would have had to scroll from the top again (see Figure 16.3., “AJAX deletion of a table row”).


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint