HTML and CSS Reference
In-Depth Information
Figure 2-4.
The example flow
Listing 2-34 shows the code of the starting input page (
input.xhtml
).
Listing 2-34.
The input.xhtml Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="
http://www.w3.org/1999/xhtml
"
xmlns:h="
http://java.sun.com/jsf/html
"
xmlns:f="
http://java.sun.com/jsf/core
"
>
<h:head>
<title>Sleeping hours checker</title>
</h:head>
<h:body>
<h:form>
<h1>Sleeping hours checker</h1>
<h:outputText value="Enter your sleeping hours: "/>
<h:inputText id="sleepingHours"
value="#{sleeping.hours}"
required="true">
<f:convertNumber integerOnly="true" maxIntegerDigits="2" />
</h:inputText>
<br/>
<h:commandButton action="proceed" value="Check my sleeping hours"/>
</h:form>
</h:body>
</html>
The form contains an input text,
sleepingHours
, which is required and accepts only integer numbers with two
digits by using the
<f:convertNumber integerOnly="true" maxIntegerDigits="2" />
converter.
