This tag renders html form element which contains the data that is submitted with the form. This tag uses "POST" method. The components under the particular form i.e. children of the form only are processed. "id" attribute is used to uniquely identify the form. CSS can be used to make it more attractive.
Code Description :
| <%@ page contentType="text/html" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <f:view> <html> <head><title>jsf h:form example</title></head> <body> <h:form> <h:outputText value="Enter your name: " /></td> <h:inputText value="#{StoreNameBean.personName}" /> <h:commandButton action="result" value="Say Hello" /> </h:form> </body> </html> </f:view> |
Rendered Output :

Html Source Code :
| <html> <head><title>jsf h:form example</title></head> <body> <form id="_id0" method="post" action="/h-tags/pages/form/form.jsf" enctype="application/x-www-form-urlencoded"> Enter your name: </td> <input type="text" name="_id0:_id2" /> <input type="submit" name="_id0:_id3" value="Say Hello" /> <input type="hidden" name="_id0" value="_id0" /></form> </body> </html> |
This tag contains some attributes that are discussed below :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: JSF form tag
Post your Comment