Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

JSF form tag

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

Ads

Tutorials   
JSF Tutorials: Easy steps to learn JSF Java Server Faces (JSF) Tutorials What is JSF Mojarra? JSF Life Cycle JSF Examples JSF Tutorial For Beginners Roseindia JSF Tutorial JSF core Tag Reference JSF internationalization example Tomahawk selectOneCountry tag RCFaces About Hibernate, Spring and JSF Integration Tutorial Creating Login Page In JSF using NetBeans JSF Hello World Declaring the Bean class in the faces-config.xml file Creating a Web Application with the JSF Framework Binding the Form Elements With the Bean Properties Adding Navigation in JSF Application Binding Component Instance to a Bean Property Tomahawk validateEqual tag Tomahawk validateEmail tag Tomahawk validateCreditCard tag Tomahawk selectOneListbox tag Tomahawk selectManyListbox tag Tomahawk selectManyCheckbox tag Tomahawk selectBooleanCheckbox tag Tomahawk saveState tag Tomahawk popup tag Tomahawk inputCalendar tag Tomahawk htmlTag tag Tomahawk graphicImage tag Tomahawk documentHead tag Tomahawk documentBody tag Tomahawk document tag Tomahawk column tag DataBase Connectivity with MySql in Visual Web JSF Application Using Net Beans IDE Retrieve Image in JSF From MySQL Table Using NetBeans IDE JSF Training Java Sever Faces 1.2 - JSF 1.2 Display Data from Database in JSF Application Business Objects of Business Logic tier Setup MySQL Database Working with Database through JDBC Working with JavaScript & CSS Referencing a Localized Message Referencing Resource Bundle from a Page Binding Component Value to an Implicit Object Phase Listener Value Change Event Listener Action Event Listener
Ads

JSF form tag

    

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 :

  • id : This attribute is used to uniquely identify the element within the closest container. 
  • rendered : Its a boolean attribute. Its default value is true. It determines whether this component should be rendered or not.
  • binding : It takes the value binding expression that is used to link the component to the property of the backing bean.
  • dir : It is used to set the direction of the text to be displayed. It can take two values LTR(left to right) and RTL (right to left). 
  • lang : It is used to set the base language of the component when displayed. 
  • style : It is used to set the CSS style definition for the component.
  • title : It is the standard html attribute. It is used to set the tooltip text for this component.
  • styleClass : It is used to set the CSS class for the component. 
  • target : This is used to identify the name of the frame where the response generated by the server is displayed when we submit the form.
  • accept : Its a comma separated list of content types that is handled by the server which processes this form.
  • acceptcharset : It is used to list character encoding used for the data input by the user and that will be accepted by the user.
  • enctype : This is used to set the content type of the data that will be submitted to the server.
  • onclick : Script to be invoked when the element is clicked. 
  • ondblclick : It is used for Java Script code to be invoked when the element is double-clicked. 
  • onmousedown : It is used for Java Script code to be invoked when the pointing device is pressed over this element. 
  • onmouseup : It is used for Java Script code to be invoked when the pointing device is released over this element. 
  • onmouseover : It is used for Java Script code to be invoked when the pointing device is moved into this element. 
  • onmousemove : It is used for Java Script code to be invoked when the pointing device is moved while it is in this element. 
  • onmouseout : It is used for Java Script code to be invoked when the pointing device is moves out of this element. 
  • onkeypress : It is used for Java Script code to be invoked when a key is pressed over this element. 
  • onkeydown : It is used for Java Script code to be invoked when a key is pressed down over this element. 
  • onkeyup : It is used for Java Script code to be invoked when a key is released over this element. 
  • onreset : It is used for Java Script code to be invoked when form is reset. 
  • onsubmit : It is used for Java Script code to be invoked when form is submitted.

Advertisements

Share on Google+Share on Google+

JSF form tag

Posted on: February 22, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: JSF form tag  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
rahul sharma
August 19, 2011
change button's color

sir, i would like to know how to change the color of submit button of primefaces. I did apply the css on submit button but this css not work on this component, because this css get overwrite by the prime faces inbuilt css.

Ads

 

Ads