Java Reference
In-Depth Information
Modifying our page to capture user data
The generated application, of course, is nothing but a starting point for us to create a
new application. We will now modify the generated
index.xhtml
file to collect some
data from the user.
The first thing we need to do is to add an
<h:form>
tag to our page. The
<h:form>
tag is equivalent to the
<form>
tag in standard HTML pages. After typing the first
few characters of the
<h:form>
tag into the page, NetBeans automatically suggests
some tags for us to use.
As soon as we highlight the tag we want
(<h:form>
in this case), NetBeans displays
that tag's documentation.
After adding the
<h:form>
tag and a number of additional JSF tags, our page
markup now looks like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>