HTML and CSS Reference
In-Depth Information
public void setUserProfile(UserProfile userProfile) {
this.userProfile = userProfile;
}
}
Ajax request delay
A
delay
attribute was added to the
<f:ajax />
tag in JSF 2.2. The attribute takes an integer containing the number of
milliseconds to wait until the Ajax request is executed. This is very useful when you use Ajax with keyboard input from
the user. Rather than executing the requests immediately as the user enters a key, it waits a number of milliseconds to
see if another key is entered before executing the request. If another key is entered, prior Ajax requests are cancelled
and only the last request is executed. Listing 5-30 shows an example of Ajax requests being delayed by 1.5 seconds
after pressing a key, giving time to the user to finish typing before dispatching the request.
Listing 5-30.
Delaying the Ajax Request by 1.5 Seconds
<h:inputText value="#{registrationBean.username}" >
<f:ajax event="keyup"
delay="1500"
render="confirmation" />
</h:inputText>
<h:outputText id="confirmation" value="#{registrationBean.confirmationMsg}" />
New XML namespaces
As you may have noticed in the previous examples, JSF 2.2 has introduced new XML namespaces. The old
namespaces started with
http://java.sun.com
,
whereas the new namespaces start with
http://xmlns.jcp.org
.
The old namespaces will still work for now, but it looks like they will be removed in future versions. The new XML
namespaces are listed in Table
5-1
.
Table 5-1.
New XML Namespaces for JSF Libraries
Library
Old URI
New URI
Composite Components
Faces Core
Faces HTML
JSTL Core
JSTL Functions
Facelets Templating
Pass Through
Attributes
Pass Through
Elements


