h:form |
|
The form tag renders an HTML form element. JSF forms use the
"post-back" technique to submit form data back to the page that contains the
form.
The use of the POST method is also required and it is not possible
to use the GET method for forms generated by this tag. If your application
requires the use of the GET method for form submission, your options include
using plain HTML forms, binding request parameters to backing bean properties,
and using the outputLink tag to generate dynamic hyperlinks.
JSF Example
<!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://java.sun.com/jsf/html">
<h:head />
<body>
<h:form>
<h:outputLabel value="Enter your name: " />
<h:inputText value="#{customerController.customer.firstName}" />
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.
Rendered Output
HTML Output
<form id="j_idt5" name="j_idt5" method="post" action="..."
enctype="application/x-www-form-urlencoded">
<label>Enter your name: </label>
<input type="text" name="j_idt5:j_idt7" />
...
</form>
|