Skip to Main Content
Mastering JavaServer Faces 2.2
book

Mastering JavaServer Faces 2.2

by Anghel Leonard
June 2014
Intermediate to advanced content levelIntermediate to advanced
578 pages
12h 2m
English
Packt Publishing
Content preview from Mastering JavaServer Faces 2.2

Explicit loading of jsf.js

The AJAX mechanism used by JSF is encapsulated in a JavaScript file, named jsf.js. This file is available in the javax.faces library. When we are using <f:ajax>, this file is loaded behind the scene without any explicit requirements.

However, jsf.js can be loaded explicitly with any of the following methods:

  • Using the <h:outputScript> component as follows:
    <h:outputScript name="jsf.js" library="javax.faces" target="head"/>
  • Using the @ResourceDependency keyword as follows:
    @ResourceDependency(name="jsf.js" library="javax.faces" target="head")

Focusing on <h:outputScript>, you can attach AJAX to a component as shown in the following example code:

<h:form prependId="false">             
  <h:outputScript name="jsf.js" library
="javax.faces" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaServer Faces

JavaServer Faces

Hans Bergsten

Publisher Resources

ISBN: 9781782176466Supplemental Content