Guide‎ > ‎JSF 2.0‎ > ‎

2. Getting Started - Simple Form in JSF 2.0

Use Components for Simple Form:

  • JSF panelGrid
  • JSF outputText
  • PrimeFaces Panel
  • PrimeFaces inputText
  • PrimeFaces  commandButton
  • PrimeFaces Dialog

Important Syntax:

JSF outputText Syntax:

Note : 

outputText act as Label


<h:outputText value="Label Name" />  

PrimeFaces inputText Syntax:

Note :

inputText act as TextBox


wihtout Value
with Value
<p:inputText value="Default Value"/>

PrimeFaces commandButton Syntax:


act as Button.
It has some control like web page to Java Class
action=""   -> it is use redirect jsf pages or call java functions(cannot call actionListioners).
actionListener=" " -> it is use to call java(baking bean) functions(actionListioners Only,cannot call normal functions).
onclick="" -> it is use for Ajax based actions(this action is not avilable in normal JSFcommandButton).


<p:commandButton value="Button Name" onclick=";" type="button" />

Implementation Code For JSF Simple Form:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""
        <title>Facelet Title</title>
            <p:panel header="Simple Form in JSF 2.0 - little drops @">
                <h:panelGrid columns="2">
                    <h:outputText value="Name" />  
                    <p:inputText />
                    <h:outputText value="No" />                      
                    <h:outputText value="Address" />  

                <f:facet name="footer">    
                    <p:commandButton value="Finish"  onclick=";" type="button" />

            <p:dialog header="Conformation Dialog" widgetVar="dlg1" width="500">Simple Form In JSF 2.0 - little drops @</p:dialog>

Copy and Paste In Your XHTML web Pages