Java Reference
In-Depth Information
{ex-
ecute:'inputname',render:'outputname'});
return false;" />
</h:form>
The
jsf.ajax.request
method takes up to three parameters that specify source,
event, and options. The source parameter identifies the DOM element that triggered the
Ajax request, typically
this
. The optional event parameter identifies the DOM event that
triggered this request. The optional options parameter contains a set of name/value pairs
from
Table 4-5
.
TABLE 4-5. Possible Values for the Options Parameter
If no identifier is specified, the default assumed keyword for the
execute
attribute is
@this
, and for the
render
attribute it is
@none
.
You can also place the JavaScript method in a file and include it as a resource.
Using the
@ResourceDependency
Annotation in a Bean Class
Use
the
javax.faces.application.ResourceDependency
annotation
to
cause the bean class to load the default
jsf.js
library.
To load the Ajax resource from the server side, use the
jsf.ajax.request
method
within the bean class. This method is usually used when creating a custom component or
a custom renderer for a component.
The following example shows how the resource is loaded in a bean class:
@ResourceDependency(name="jsf.js" library="javax.faces" tar-
get="head")