SlideShare a Scribd company logo
1 of 7
Download to read offline
Subscribe Now for FREE! refcardz.com
                                                                                                                                                                          tech facts at your fingertips

                                           CONTENTS INCLUDE:




                                                                                                                  JavaServer Faces
                                           n	
                                                 Development Process
                                           	n	
                                                 Lifecycle
                                           n	
                                                 Faces-config.xml
                                           n	
                                                 The JSF Expression Language
                                                 JSF Core Tags
                                                                                                                                                                         By Cay S. Horstmann
                                           n	



                                           n	
                                                 JSF HTML Tags and more...


                                                                                                                                               These common tasks give you a crash course into using JSF.
                                                    AbOUT ThIS REfCARD
                                                                                                                                               Text field
                                                   JavaServer Faces (JSF) is the “official” component-based
                                                                                                                                               page.jspx
                                                   view technology in the Java EE web tier. JSF includes a set                                    <h:inputText value=quot;#{bean1.luckyNumber}quot;>
                                                   of predefined UI components, an event-driven programming
                                                   model, and the ability to add third-party components. JSF                                   faces-config.xml
                                                                                                                                                  <managed-bean>
                                                   is designed to be extensible, easy to use, and toolable. This
                                                                                                                                                     <managed-bean-name>bean1</managed-bean-name>
                                                   refcard describes the JSF development process, standard JSF                                       <managed-bean-class>com.corejsf.SampleBean</
                                                   tags, the JSF expression language, and the faces-config.xml                                        managed-bean-class>
                                                   configuration file.                                                                               <managed-bean-scope>session</managed-bean-scope>
                                                                                                                                                  </managed-bean>

                                                    DEvELOpmENT pROCESS                                                                        com/corejsf/SampleBean.java
                                                                                                                                                  public class SampleBean {
                                                                                                                                                        public int getLuckyNumber() { ... }
                                                   A developer specifies JSF components in JSF pages,
                                                                                                                                                        public void setLuckyNumber(int value) { ... }
                                                   combining JSF component tags with HTML and CSS for styling.                                       ...
                                                   Components are linked with managed beans—Java classes                                          }
                                                   that contain presentation logic and connect to business logic
                                                   and persistence backends. Entries in faces-config.xml contain                               Button
    www.dzone.com




                                                   navigation rules and instructions for loading managed beans.
                                                                                                                                               page.jspx
                                                                                                                                                  <h:commandButton value=quot;press mequot; action=quot;#{bean1.
                                                                     servlet container
                                                                                                                                                   login}quot;/>
                                                    client devices   web application
                                                                                                                                               faces-config.xml
                                                                     presentation      application logic   business logic                         <navigation-rule>
                                                                                       navigation
                                                                                       validation                                                    <navigation-case>
                                                                                                                            database
                                                                                       event handling                                                     <from-outcome>success</from-outcome>
                                                                     JSF Pages         Managed Beans                                                      <to-view-id>/success.jspx</to-view-id>
                                                                                                                                                     </navigation-case>
                                                                                                                             web
                                                                                                                            service                  <navigation-case>
                                                                                         JSF framework
                                                                                                                                                          <from-outcome>error</from-outcome>
                                                                                                                                                          <to-view-id>/error.jspx</to-view-id>
                                                                                                                                                          <redirect/>
                                                                                                                                                     </navigation-case>
                                                   A JSF page has the following structure:
                                                                                                                                                  </navigation-rule>
                                                    JSP Style                       Proper XML
                                                                                                                                                                                                            →
                                                    <html>                          <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
                                                      <%@ taglib                    <jsp:root xmlns:jsp=quot;http://java.sun.com/
                                                      uri=quot;http://                  JSP/Pagequot;
                                                        java.sun.com/jsf/               xmlns:f=quot;http://java.sun.com/jsf/corequot;
                                                      corequot;                             xmlns:h=quot;http://java.sun.com/jsf/htmlquot;
                                                        prefix=quot;fquot; %>                   version=quot;2.0quot;>
                                                                                      <jsp:directive.page contentType=quot;text/
                                                      <%@ taglib
                                                                                        html;charset=UTF-8quot;/>
JavaServer Faces




                                                      uri=quot;http://
                                                                                      <jsp:output omit-xml-declaration=quot;noquot;
                                                        java.sun.com/jsf/
                                                                                        doctype-root-element=quot;htmlquot;
                                                      htmlquot;                             doctype-public=quot;-//W3C//DTD XHTML 1.0
                                                        prefix=quot;hquot; %>                     Transitional//ENquot;
                                                      <f:view>                          doctype-system=quot;http://www.w3.org/TR/
                                                        <head>                          xhtml1/
                                                          <title>...</                    DTD/xhtml1-transitional.dtdquot;/>
                                                    title>                            <f:view>
                                                        </head>                         <html xmlns=quot;http://www.w3.org/1999/
                                                        <body>                      xhtmlquot;>
                                                          <h:form>                        <head>
                                                          ...                               <title>...</title>
                                                          </h:form>                       </head>
                                                                                          <body>
                                                        </body>
                                                                                            <h:form>...</h:form>
                                                      </f:view>
                                                                                          </body>
                                                    </html>
                                                                                        </html>
                                                                                      </f:view>
                                                                                    </jsp:root>



                                                                                                                            DZone, Inc.   |   www.dzone.com
2
                                                                                                                JavaServer Faces
  tech facts at your fingertips




Button, continued                                                             ...
                                                                              <h:outputText value=quot;#{msgs.goodbye}!quot;
com/corejsf/SampleBean.java
                                                                               styleClass=quot;goodbyequot;>
  public class SampleBean {                                                   ...
     public String login() { if (...) return
                                                                         </body>
      quot;successquot;; else return quot;errorquot;; }
     ...                                                              faces-config.xml
  }
                                                                         <application>
                                                                         <resource-bundle>
Radio buttons
                                                                              <base-name>com.corejsf.messages</base-name>
page.jspx                                                                     <var>msgs</var>
  <h:selectOneRadio value=quot;#{form.condiment}>                            </resource-bundle>
     <f:selectItems value=quot;#{form.condimentItems}quot;/>                     </application>
  </h:selectOneRadio>                                                 com/corejsf/messages.properties
com/corejsf/SampleBean.java                                              goodbye=Goodbye

  public class SampleBean {                                           com/corejsf/messages_de.properties
     private Map<String, Object> condimentItem = null;
     public Map<String, Object> getCondimentItems() {                    goodbye=Auf Wiedersehen
        if (condimentItem == null) {
                                                                      styles.css
           condimentItem = new LinkedHashMap<String,
            Object>();                                                   .goodbye {
           condimentItem.put(quot;Cheesequot;, 1); // label, value                    font-style: italic;
           condimentItem.put(quot;Picklequot;, 2);                                    font-size: 1.5em;
           ...                                                                color: #eee;
        }                                                                }
        return condimentItem;
     }                                                                Table with links
     public int getCondiment() { ... }                                 Name
     public void setCondiment(int value) { ... }
                                                                       Washington, George    Delete
     ...
                                                                       Jefferson, Thomas     Delete
  }
                                                                       Lincoln, Abraham      Delete

Validation and Conversion                                              Roosevelt, Theodore   Delete


page.jspx                                                             page.jspx
  <h:inputText value=quot;#{payment.amount}quot;                                 <h:dataTable value=quot;#{bean1.entries}quot; var=quot;rowquot;
    required=quot;truequot;>                                                      styleClass=quot;tablequot; rowClasses=quot;even,oddquot;>
       <f:validateDoubleRange maximum=quot;1000quot;/>                              <h:column>
  </h:inputText>                                                               <f:facet name=quot;headerquot;>
  <h:outputText value=quot;#{payment.amount}quot;>                                     <h:outputText value=quot;Namequot;/>
       <f:convertNumber type=quot;currencyquot;/>                                      </f:facet>
            <!-- number displayed with currency symbol and                     <h:outputText value=quot;#{row.name}quot;/>
              group separator: $1,000.00 -->                                </h:column>
  </h:outputText>                                                           <h:column>
                                                                               <h:commandLink value=quot;Deletequot; action=quot;#{bean1.
Error Messages                                                                  deleteAction}quot; immediate=quot;truequot;>
                                                                               <f:setPropertyActionListener target=quot;#{bean1.
                                                                                idToDelete}quot;
                                                                                  value=quot;#{row.id}quot;/>
page.jspx                                                                      </h:commandLink>
  <h:outputText value=quot;Amountquot;/>                                            </h:column>
                                                                         </h:dataTable>
  <h:inputText id=quot;amountquot; label=quot;Amountquot;
    value=quot;#{payment.amount}quot;/>                                       com/corejsf/SampleBean.java
       <!-- label is used in message text -->
                                                                         public class SampleBean {
  <h:message for=quot;amountquot;/>
                                                                            private int idToDelete;
Resources and Styles                                                        public void setIdToDelete(int value) {idToDelete
                                                                             = value; }
page.jspx                                                                   public String deleteAction() {
  <head>                                                                       // delete the entry whose id is idToDelete
     <link href=quot;styles.cssquot; rel=quot;stylesheetquot;                                  return null;
      type=quot;text/cssquot;/>                                                     }
     ...                                                                    public List<Entry> getEntries() {...}
  </head>                                                                   ...
  <body>                                                                 }


                                                   DZone, Inc.   |   www.dzone.com
3
                                                                                                                                                                          JavaServer Faces
   tech facts at your fingertips




LIfECyCLE                                                                                                      web.xml

                                                   response complete                 response complete          <?xml version=quot;1.0quot;?>
                                                                                                                <web-app xmlns=quot;http://java.sun.com/xml/ns/javaeequot;
 request          Restore          Apply Request       Process          Process         Process
                   View               Values           events          Validations      events                   xmlns:xsi=quot;http://www.w3.org/2001/XMLSchemainstancequot;
                                                                                                                 xsi:schemaLocation=quot;http://java.sun.com/xml/ns/javaee
                               render response
                                                                                                                 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsdquot;
                               response complete                   response complete                             version=quot;2.5quot;>
                                                                                                                <servlet>
                   Render           Process          Invoke            Process          Update
 response                                                                               Model                      <servlet-name>Faces Servlet</servlet-name>
                  Response          events         Application         events           Values
                                                                                                                   <servlet-class>javax.faces.webapp.FacesServlet</
                                   conversion errors/render response                                                servlet-class>
                                           validation or conversion errors/render response                         <load-on-startup>1</load-on-startup>
                                                                                                                </servlet>

                                                                                                                <!-- Add this element to change the extension for
faces-config.xml                                                                                                 JSF page files (Default: .jsp) -->
                                                                                                                <context-param>
                                                                                                                   <param-name>javax.faces.DEFAULT_SUFFIX</param-
The faces-config.xml file contains a sequence of the following                                                      name>
entries.
                                                                                                                      <param-value>.jspx</param-value>
   n   managed-bean                                                                                             </context-param>
        1.   description , display-name, icon (optional)
                                                                                                                <servlet-mapping>
        2.   managed-bean-name
                                                                                                                      <servlet-name>Faces Servlet</servlet-name>
        3.   managed-bean-class
                                                                                                                      <url-pattern>*.faces</url-pattern>
        4.   managed-bean-scope
        5.   managed-property (0 or more, other optional choices                                                      <!-- Another popular URL pattern is /faces/* -->

             are map-entries and list-entries which are not                                                     </servlet-mapping>
             shown here)                                                                                        <welcome-file-list>
             1. description, display-name, icon (optional)                                                            <welcome-file>index.faces</welcome-file>
             2. property-name
                                                                                                                      <!-- Create a blank index.faces (in addition to
             3. value (other choices are null-value, map-entries,                                                      index.jspx) -->
                list-entries which are not shown here)
                                                                                                                      <welcome-file>index.html</welcome-file>
   n   navigation-rule                                                                                                <!-- Use <meta http-equiv=quot;Refreshquot; content=
        1. description, display-name, icon (optional)                                                                  quot;0; URL=index.facesquot;/> -->
        2. from-view-id (optional, can use wildcards)                                                           </welcome-file-list>
        3. navigation-case (1 or more)                                                                          </web-app>
           n from-action (optional, not common)

             n   from-outcome
             n   to-view-id                                                                                    ThE JSf ExpRESSION LANgUAgE (EL)
   n   application
                                                                                                             An EL expression is a sequence of literal strings and expressions
        m   		 resource-bundle
                                                                                                             of the form base[expr1][expr2]... As in JavaScript, you
        1. base-name
                                                                                                             can write base.identifier instead of base['identifier'] or
        2. var
        m   		 action-listener, default-render-kit-id,                                                       base[quot;identifierquot;]. The base is one of the names in the table
             resource-bundle, view-handler, state-manager, el-                                               below or a name defined in faces-config.xml.
             resolver, property-resolver, variable-resolver,
                                                                                                              header             A Map of HTTP header parameters, containing only the first
             application-extension (details not shown)                                                                           value for each name.

                                                                                                              headerValues       A Map of HTTP header parameters, yielding a String[] array of
   n   converter                                                                                                                 all values for a given name.
        m		 converter-id                                                                                      param              A Map of HTTP request parameters, containing only the first
        m		 converter-class                                                                                                      value for each name.
        m		 Optional initialization (not shown here)                                                          paramValues        A Map of HTTP request parameters, yielding a String[] array of
                                                                                                                                 all values for a given name.
   n   validator                                                                                              cookie             A Map of the cookie names and values of the current request.
        m		 validator-id                                                                                      initParam          A Map of the initialization parameters of this web application.
        m		 validator-class
                                                                                                              requestScope       A Map of all request scope attributes.
        m		 Optional initialization (not shown here)

                                                                                                              sessionScope       A Map of all session scope attributes.
   n   lifecycle
                                                                                                              applicationScope   A Map of all application scope attributes.
        m   		 phase-listener
                                                                                                              facesContext       The FacesContext instance of this request.
   n   component, factory, referenced-bean, render-kit,
                                                                                                              view               The UIViewRoot instance of this request.
       faces-config-extension (details not shown)


                                                                                        DZone, Inc.      |   www.dzone.com
4
                                                                                                                                                                     JavaServer Faces
  tech facts at your fingertips




The JSF Expression Language (EL), continued                                                            JSF Core Tags, continued
There are two expression types:                                                                         Tag                     Description/ Attributes

  n   Value expression: a reference to a bean property or an                                            f:convertNumber         Adds a number converter to a component
                                                                                                                                 type                     number (default), currency , or
      entry in a map, list, or array. Examples:                                                                                                           percent
          userBean.name calls getName or setName on the userBean                                                                 pattern                  Formatting pattern, as defined in
                                                                                                                                                          java.text.DecimalFormat
          object
                                                                                                                                 maxFractionDigits        Maximum number of digits in the
          pizza.choices[var] calls pizza.getChoices( ).get(var)                                                                                           fractional part
          or pizza.getChoices( ).put(var, ...)                                                                                   minFractionDigits        Minimum number of digits in the
                                                                                                                                                          fractional part
  n   Method expression: a reference to a method and the                                                                         maxIntegerDigits         Maximum number of digits in the
      object on which it is to be invoked. Example:                                                                                                       integer part
                                                                                                                                 minIntegerDigits         Minimum number of digits in the
          userBean.login calls the login method on the userBean                                                                                           integer part
          object when it is invoked.                                                                                             integerOnly              True if only the integer part is
                                                                                                                                                          parsed (default: false)
In JSF, EL expressions are enclosed in #{...} to indicate                                                                        groupingUsed             True if grouping separators are
deferred evaluation. The expression is stored as a string and                                                                                             used (default: true)
                                                                                                                                 locale                   Locale whose preferences are to
evaluated when needed. In contrast, JSP uses immediate                                                                                                    be used for parsing and formatting
evaluation, indicated by ${...} delimiters.                                                                                      currencyCode             ISO 4217 currency code to use
                                                                                                                                                          when converting currency values
                                                                                                                                 currencySymbol           Currency symbol to use when
                                                                                                                                                          converting currency values
 JSf CORE TAgS
                                                                                                        f:validator             Adds a validator to a component
                                                                                                                                 validatorId              The ID of the validator
Tag                               Description/ Attributes
                                                                                                        f:validateDoubleRange   Validates a double or long value, or the length of a string
f:view                            Creates the top-level view
                                                                                                        f:validateLongRange      minimum, maximum         the minimum and maximum of the
                                   locale                The locale for this view.                      f:validateLength                                  valid rang
                                   renderKitId           The render kit ID for this view
                                   (JSF 1.2)                                                            f:loadBundle            Loads a resource bundle, stores properties as a Map
                                                                                                                                 basename       The resource bundle name
                                   beforePhase,          Phase listeners that are called in
                                   afterPhase            every phase except quot;restore viewquot;                                       value          The name of the variable that is bound to
                                                                                                                                                the bundle map
f:subview                         Creates a subview of a view
                                                                                                        f:selectitems           Specifies items for a select one or select many component
                                   binding, id, rendered         Basic attributes
                                                                                                                                 binding, id      Basic attributes
f:facet                           Adds a facet to a component                                                                    value            Value expression that points to a
                                                                                                                                                  SelectItem, an array or Collection of
                                   name                          the name of this facet                                                           SelectItem objects, or a Map mapping
                                                                                                                                                  labels to values.
f:attribute                       Adds an attribute to a component
                                   name, value     the name and value of the attribute to set           f:selectitem            Specifies an item for a select one or select many
                                                                                                                                component
f:param                           Constructs a parameter child component                                                         binding, id             Basic attributes
                                   name              An optional name for this parameter                                         itemDescription         Description used by tools only
                                                     component.
                                                                                                                                 itemDisabled            Boolean value that sets the item’s
                                   value             The value stored in this component.                                                                 disabled property
                                   binding, id       Basic attributes                                                            itemLabel               Text shown by the item
                                                                                                                                 itemValue               Item’s value, which is passed to the
f:actionListener                  Adds an action listener or value change listener to a                                                                  server as a request parameter
f:valueChangeListener             component
                                                                                                                                 value                   Value expression that points to a
                                   type          The name of the listener class                                                                          SelectItem instance


f:setPropertyChange               Adds an action listener to a component that sets a bean               f:verbatim              Adds markup to a JSF page
Listener (JSF 1.2)                property to a given value.                                                                     escape                  If set to true, escapes <, >, and &
                                                                                                                                                         characters. Default value is false.
                                   value            The bean property to set when the
                                                    action event occurs                                                          rendered (JSF 1.2)      Basic attributes

                                   binding, id      The value to set it to

f:converter                       Adds an arbitary converter to a component
                                                                                                         JSf hTmL TAgS
                                   converterId      The ID of the converter

f:convertDateTime                 Adds a datetime converter to a component                              Tag                      Description

                                   type             date (default), time, or both                       h:form                   HTML form

                                   dateStyle        default, short, medium, long, or full               h:inputText              Single-line text input control

                                   timeStyle        default, short, medium, long, or full
                                                                                                        h:inputTextarea          Multiline text input control
                                   pattern          Formatting pattern, as defined in java.
                                                    text.SimpleDateFormat
                                                                                                        h:inputSecret            Password input control
                                   locale           Locale whose preferences are to be used
                                                    for parsing and formatting
                                                                                                        h:inputHidden            Hidden field
                                   timezone         Time zone to use for parsing and
                                                    formatting                                          h:outputLabel            Label for another
                                                                                                                                 component for accessibility
                                                                                                                                                                                                →

                                                                                     DZone, Inc.   |   www.dzone.com
5
                                                                                                                                                                              JavaServer Faces
     tech facts at your fingertips




JSF HTML tags, continued                                                                                  Attributes for h:inputText ,
                                                                                                          h:inputSecret, h:inputTextarea ,
Tag                                  Description
                                                                                                          and h:inputHidden
h:outputLink                         HTML anchor
                                                                                                           Attribute                           Description
                                                                                                           cols                                For h:inputTextarea only—number of columns
h:outputFormat                       Like outputText, but
                                     formats compound                                                      immediate                           Process validation early in the life cycle
                                     messages                                                              redisplay                           For h:inputSecret only—when true, the input
h:outputText                         Single-line text output                                                                                   field’s value is redisplayed when the web page is
                                                                                                                                               reloaded
h:commandButton                      Button: submit, reset, or
                                     pushbutton                                                            required                            Require input in the component when the form is
                                                                                                                                               submitted
h:commandLink                        Link that acts like a           register                              rows                                For h:inputTextarea only—number of rows
                                     pushbutton.
                                                                                                           valueChangeListener                 A specified listener that’s notified of value changes
h:message                            Displays the most recent        Amount       too much
                                     message for a component         Amount:'too much' is not a            binding, converter, id, rendered,   Basic attributes
                                                                     number.                               required, styleClass, value,
                                                                     Example: 99                           validator

h:messages                           Displays all messages                                                 accesskey, alt, dir,                HTML 4.0 pass-through attributes—alt, maxlength,
                                                                                                           disabled, lang, maxlength,          and size do not apply to h:inputTextarea. None
                                                                                                           readonly, size, style,              apply to h:inputHidden
                                                                                                           tabindex, title
h:grapicImage                        Displays an image                                                     onblur, onchange, onclick,          DHTML events. None apply to h:inputHidden
                                                                                                           ondblclick, onfocus,
                                                                                                           onkeydown, onkeypress,
h:selectOneListbox                   Single-select listbox                                                 onkeyup, onmousedown,
                                                                                                           onmousemove, onmouseout,
                                                                                                           onmouseover, onselect


h:selectOneMenu                      Single-select menu
                                                                                                          Attributes for h:outputText and
                                                                                                          h:outputFormat
                                                                                                           Attribute                                          Description

h:selectOneRadio                     Set of radio buttons                                                  escape                                             If set to true, escapes <, >, and &
                                                                                                                                                              characters. Default value is true.
h:selectBooleanCheckbox              Checkbox                                                              binding, converter, id, rendered,                  Basic at tributes
                                                                                                           styleClass, value
h:selectManyCheckbox                 Multiselect listbox
                                                                                                           style, title                                       HTML 4.0
h:selectManyListbox                  Multiselect listbox

                                                                                                          Attributes for h:outputLabel
                                                                                                           Attribute                                   Description
h:selectManyMenu                     Multiselect menu                                                      for                                         The ID of the component to be labeled.
h:panelGrid                          HTML table                                                            binding, converter, id, rendered,           Basic attributes
                                                                                                           value
h:panelGroup                         Two or more components
                                     that are laid out as one
h:dataTable                          A feature-rich table
                                     component
h:column                             Column in a data table                                               Attributes for h:graphicImage
                                                                                                           Attribute                                                   Description
Basic Attributes                                                                                           binding, id, rendered, styleClass, value                    Basic attributes

Attribute                        Description                                                               alt, dir, height, ismap, lang, longdesc, style,             HTML 4.0
                                                                                                           title, url, usemap, width
id                               Identifier for a component
                                                                                                           onblur, onchange, onclick, ondblclick, onfocus,             DHTML events
binding                          Reference to the component that can be used in a backing
                                                                                                           onkeydown, onkeypress, onkeyup, onmousedown,
                                 bean
                                                                                                           onmousemove, onmouseout, onmouseover,
rendered                         A boolean; false suppresses rendering                                     onmouseup
styleClass                       Cascading stylesheet (CSS) class name
value                            A component’s value, typically a value binding                           Attributes for h:commandButton
valueChangeListener              A method binding to a method that responds to value                      and h:commandLink
                                 changes
                                                                                                           Attribute                             Description
converter                        Converter class name
validator                        Class name of a validator that’s created and attached to a                action                                If specified as a string: Directly specifies an
                                 component                                                                                                       outcome used by the navigation handler to
                                                                                                                                                 determine the JSF page to load next as a result
required                         A boolean; if true, requires a value to be entered in the                                                       of activating the button or link If specified as a
                                 associated field                                                                                                method binding: The method has this signature:
                                                                                                                                                 String methodName(); the string represents
                                                                                                                                                 the outcome
Attributes for h:form                                                                                      actionListener                        A method binding that refers to a method with
                                                                                                                                                 this signature: void methodName(ActionEvent)
Attribute                                                      Description                                 charset                               For h:commandLink only—The character
binding, id, rendered, styleClass                              Basic attributes                                                                  encoding of the linked reference
                                                                                                           image                                 For h:commandButton only—A context-relative
accept, acceptcharset, dir, enctype, lang,                     HTML 4.0 attributes                                                               path to an image displayed in a button. If you
style, target, title                                           (acceptcharset corresponds to                                                     specify this attribute, the HTML input’s type will
                                                               HTML accept-charset)                                                              be image.
onblur, onchange, onclick, ondblclick, onfocus, DHTML events                                               immediate                             A boolean. If false (the default), actions and action
onkeydown, onkeypress, onkeyup, onmousedown,
                                                                                                                                                 listeners are invoked at the end of the request
onmousemove, onmouseout, onmouseover, onreset,
                                                                                                                                                 life cycle; if true, actions and action listeners are
onsubmit
                                                                                                                                                 invoked at the beginning of the life cycle.



                                                                                        DZone, Inc.   |   www.dzone.com
6
                                                                                                                                                                  JavaServer Faces
   tech facts at your fingertips




h:commandButton and h:commandLink ,                                                             Attributes for h:message and h:messages
continued
Attribute                                 Description
type                                      For h:commandButton: The type of                       Attribute           Description
                                          the generated input element: button,
                                          submit, or reset. The default, unless you              for                 The ID of the component whose message is displayed—applicable
                                          specify the image attribute, is submit. For                                only to h:message
                                          h:commandLink: The content type of the
                                          linked resource; for example, text/html, image/        errorClass          CSS class applied to error messages
                                          gif, or audio/basic                                    errorStyle          CSS style applied to error messages
value                                     The label displayed by the button or link.
                                                                                                 fatalClass          CSS class applied to fatal messages
                                          You can specify a string or a value reference
                                          expression.                                            fatalStyle          CSS style applied to fatal messages
accesskey, alt, binding, id, lang,        Basic attributes                                       globalOnly          Instruction to display only global messages—applicable only to
rendered, styleClass, value
                                                                                                                     h:messages. Default: false
coords (h:commandLink only), dir,         HTML 4.0
disabled (h:commandButton only),                                                                 infoClass           CSS class applied to information messages
hreflang (h:commandLink only),
lang, readonly, rel (h:commandLink
                                                                                                 infoStyle           CSS style applied to information messages
only), rev (h:commandLink only),                                                                 layout              Specification for message layout: table or list—applicable only
shape (h:commandLink only), style,                                                                                   to h:messages
tabindex, target (h:commandLink
only), title, type                                                                               showDetail          A boolean that determines whether message details are shown.
onblur, onchange, onclick,                DHTML events                                                               Defaults are false for h:messages, true for h:message
ondblclick, onfocus, onkeydown,
onkeypress, onkeyup, onmousedown,                                                                showSummary         A boolean that determines whether message summaries are
onmousemove, onmouseout,                                                                                             shown. Defaults are true for h:messages, false for h:message
onmouseover, onmouseup, onselect
                                                                                                 tooltip             A boolean that determines whether message details are rendered
                                                                                                                     in a tooltip; the tooltip is only rendered if showDetail and
                                                                                                                     showSummary are true

                                                                                                 warnClass           CSS class for warning messages
Attributes for h:outputLink                                                                      warnStyle           CSS style for warning messages

Attribute                                        Description                                     binding, id,        Basic attributes
                                                                                                 rendered,
accesskey, binding, converter, id,               Basic attributes                                styleClass
lang, rendered, styleClass, value
                                                                                                 style, title        HTML 4.0
charset, coords, dir, hreflang, lang,            HTML 4.0
rel, rev, shape, style, tabindex,
target, title, type
                                                                                                Attributes for h:panelGrid
onblur, onchange, onclick, ondblclick,           DHTML events
onfocus, onkeydown, onkeypress, onkeyup,                                                         Attribute                   Description
onmousedown, onmousemove, onmouseout,
onmouseover, onmouseup                                                                           bgcolor                     Background color for the table

                                                                                                 border                      Width of the table’s border

Attributes for:                                                                                  cellpadding                 Padding around table cells

h:selectBooleanCheckbox ,                                                                        cellspacing                 Spacing between table cells

h:selectManyCheckbox , h:selectOneRadio ,                                                        columnClasses               Comma-separated list of CSS classes for columns

h:selectOneListbox , h:selectManyListbox ,                                                       columns                     Number of columns in the table
h:selectOneMenu , h:selectManyMenu                                                               footerClass                 CSS class for the table footer

                                                                                                 frame                       Specification for sides of the frame surrounding the table
                                                                                                                             that are to be drawn; valid values: none, above, below,
                                                                                                                             hsides, vsides, lhs, rhs, box, border
Attribute                          Description
                                                                                                 headerClass                 CSS class for the table header
disabledClass                      CSS class for disabled elements—for
                                   h:selectOneRadio and h:selectManyCheckbox                     rowClasses                  Comma-separated list of CSS classes for columns
                                   only                                                          rules                       Specification for lines drawn between cells; valid values:
                                                                                                                             groups, rows, columns, all
enabledClass                       CSS class for enabled elements—for
                                   h:selectOneRadio and h:selectManyCheckbox                     summary                     Summary of the table’s purpose and structure used for
                                   only                                                                                      non-visual feedback such as speech
layout                             Specification for how elements are laid out:                  binding, id, rendered,      Basic attributes
                                   lineDirection (horizontal) or pageDirection                   styleClass, value
                                   (vertical)—for h:selectOneRadio and
                                   h:selectManyCheckbox only                                     dir, lang, style,           HTML 4.0
                                                                                                 title, width
binding, converter, id,            Basic attributes
immediate, styleClass,                                                                           onclick, ondblclick,        DHTML events
required, rendered,                                                                              onkeydown, onkeypress,
validator, value,                                                                                onkeyup, onmousedown,
valueChangeListener                                                                              onmousemove,
                                                                                                 onmouseout,
accesskey, border, dir,            HTML 4.0—border is applicable to                              onmouseover,
disabled, lang, readonly,          h:selectOneRadio and h:selectManyCheckbox                     onmouseup
style, size, tabindex,             only. size is applicable to h:selectOneListbox and
title                              h:selectManyListbox only

onblur, onchange, onclick,
ondblclick, onfocus,
                                   DHTML events
                                                                                                Attributes for h:panelGroup
onkeydown, onkeypress,
onkeyup, onmousedown,                                                                            Attribute                                 Description
onmousemove, onmouseout,                                                                         binding, id, rendered,                    Basic attributes
onmouseover, onmouseup,                                                                          styleClass
onselect
                                                                                                 style                                     HTML 4.0



                                                                              DZone, Inc.   |   www.dzone.com
7
                                                                                                                                                                                                              JavaServer Faces
              tech facts at your fingertips




       Attributes for h:dataTable                                                                                                Attributes for h:dataTable , continued
        Attribute                           Description                                                                            Attribute                                Description
        bgcolor                             Background color for the table                                                         var                                      The name of the variable created by the data table that
                                                                                                                                                                            represents the current item in the value
        border                              Width of the table’s border
                                                                                                                                   binding, id, rendered,                   Basic attributes
        cellpadding                         Padding around table cells                                                             styleClass, value
        cellspacing                         Spacing between table cells                                                            dir, lang, style, title,                 HTML 4.0
        columnClasses                       Comma-separated list of CSS classes for columns                                        width

        first                               Index of the first row shown in the table                                              onclick, ondblclick,                     DHTML events
                                                                                                                                   onkeydown, onkeypress,
        footerClass                         CSS class for the table footer                                                         onkeyup, onmousedown,
        frame                               Frame Specification for sides of the frame surrounding the                             onmousemove, onmouseout,
                                            table that are to be drawn; valid values: none, above, below,                          onmouseover, onmouseup
                                            hsides, vsides, lhs, rhs, box, border
        headerClass                         CSS class for the table header                                                       Attributes for h:column
        rowClasses                          Comma-separated list of CSS classes for rows                                           Attribute                                           Description
        rules                               Specification for lines drawn between cells; valid values:                             headerClass (JSF 1.2)                               CSS class for the column's header
                                            groups, rows, columns, all
                                                                                                                                   footerClass (JSF 1.2)                               CSS class for the column's footer
        summary                             Summary of the table's purpose and structure used for non-
                                            visual feedback such as speech                                                         binding, id, rendered                               Basic attributes




     AbOUT ThE AUThOR                                                                                                                                         RECOmmENDED bOOK

                              Cay S. Horstmann
                                                                                                                                                                                                     Core JavaServer Faces
                              Cay S. Horstmann has written many books on C++, Java and object-
                              oriented development, is the series editor for Core Books at Prentice-Hall                                                                                             delves into all facets of
                              and a frequent speaker at computer industry conferences. For four years,                                                                                               JSF development, offering
                              Cay was VP and CTO of an Internet startup that went from 3 people in a                                                                                                 systematic best practices for
                              tiny office to a public company. He is now a computer science professor                                                                                                building robust applications
                              at San Jose State University. He was elected Java Champion in 2005.
                                                                                                                                                                                                     and maximizing developer
     List of recent books/publications                                                                                                                                                               productivity.
     •	 Core Java, with Gary Cornell, Sun Microsystems Press 1996 - 2007 (8 editions)
     •	 	 ore JavaServer Faces, with David Geary, Sun Microsystems Press, 2004-2006 (2 editions)
        C
     •	 	 ig Java, John Wiley & Sons 2001 - 2007 (3 editions)
        B
                                                                                                                                                                                                 bUy NOW
     Blog                                                                           Web site
                                                                                                                                                                               books.dzone.com/books/jsf
     http://weblogs.java.net/blog/cayhorstmann                                      http://horstmann.com



 Want More? Download Now. Subscribe at refcardz.com
 Upcoming Refcardz:                                        Available:
 n   		Core CSS II                                        Published September 2008                                     Published June 2008
 n   		Ruby                                               n   	 Getting Started with JPA                               n   	 jQuerySelectors                                       fREE
                                                              	 Core CSS I
     		Core CSS III                                                                                                        	 Design Patterns
                                                          n
 n                                                                                                                     n

                                                          n   	 Struts 2
 n   		SOA Patterns                                                                                                    n   	 Flexible Rails: Flex 3 on Rails 2
                                                          Published August 2008
 n   		Scalability and High                               n   	 Very First Steps in Flex                               Published May 2008
 n   		Agile Methodologies                                n   	 C#                                                     n   	 Windows PowerShell
                                                          n   	 Groovy                                                     	 Dependency Injection in EJB 3
 n   		Spring Annotations                                 n   	 Core .NET
                                                                                                                       n




 n   		PHP
                                                          Published July 2008
 n   		Core Java                                          n   		NetBeans IDE 6.1 Java Editor                           Visit http://refcardz.dzone.com
     		JUnit                                                  		RSS and Atom                                           for a complete listing of
                                                                                                                                                                                                                   Design Patterns
                                                          n
 n


                                                              		GlassFish Application Server                           available Refcardz.
 n   		MySQL                                              n

                                                                                                                                                                                                               Published June 2008
                                                          n   		Silverlight 2
     		Seam
                                                              		IntelliJ IDEA
 n
                                                          n




                                                                                                                              DZone, Inc.
                                                                                                                              1251 NW Maynard
                                                                                                                                                                                             ISBN-13: 978-1-934238-19-6
                                                                                                                              Cary, NC 27513
                                                                                                                                                                                             ISBN-10: 1-934238-19-8
                                                                                                                                                                                                                            50795
                                                                                                                              888.678.0399
DZone communities deliver over 3.5 million pages per month to                                                                 919.678.0300
more than 1.5 million software developers, architects and designers.
                                                                                                                              Refcardz Feedback Welcome
DZone offers something for every developer, including news,                                                                   refcardz@dzone.com
                                                                                                                                                                                                                                         $7.95




tutorials, blogs, cheatsheets, feature articles, source code and more.                                                        Sponsorship Opportunities                                   9 781934 238196
“DZone is a developer’s dream,” says PC Magazine.                                                                             sales@dzone.com
Copyright © 2008 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical,                             Version 1.0
photocopying, or otherwise, without prior written permission of the publisher. Reference: Core JavaServer Faces, David Geary and Cay S. Horstmann, Sun Microsystems Press, 2004-2006.

More Related Content

Similar to Jsf Online F

Similar to Jsf Online F (20)

06-Event-Handlingadvansed
06-Event-Handlingadvansed06-Event-Handlingadvansed
06-Event-Handlingadvansed
 
Seam Glassfish Perspective
Seam Glassfish PerspectiveSeam Glassfish Perspective
Seam Glassfish Perspective
 
JSF2 and JSP
JSF2 and JSPJSF2 and JSP
JSF2 and JSP
 
Jsf+ejb 50
Jsf+ejb 50Jsf+ejb 50
Jsf+ejb 50
 
JSF and Seam
JSF and SeamJSF and Seam
JSF and Seam
 
Jsf
JsfJsf
Jsf
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
JBoss Seam 1 part
JBoss Seam 1 partJBoss Seam 1 part
JBoss Seam 1 part
 
AK 4 JSF
AK 4 JSFAK 4 JSF
AK 4 JSF
 
AK 5 JSF 21 july 2008
AK 5 JSF   21 july 2008AK 5 JSF   21 july 2008
AK 5 JSF 21 july 2008
 
JSF 2.0 Preview
JSF 2.0 PreviewJSF 2.0 Preview
JSF 2.0 Preview
 
Lab 5b) create a java server faces application
Lab 5b) create a java server faces applicationLab 5b) create a java server faces application
Lab 5b) create a java server faces application
 
Jsf Framework
Jsf FrameworkJsf Framework
Jsf Framework
 
JSF-Starter
JSF-StarterJSF-Starter
JSF-Starter
 
JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011JBoss AS7 OSDC 2011
JBoss AS7 OSDC 2011
 
Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
 
Facelets
FaceletsFacelets
Facelets
 
Web Applications of the future: Combining JEE6 & JavaFX
Web Applications of the future: Combining JEE6 & JavaFXWeb Applications of the future: Combining JEE6 & JavaFX
Web Applications of the future: Combining JEE6 & JavaFX
 
soft-shake.ch - JBoss AS 7, la révolution
soft-shake.ch - JBoss AS 7, la révolutionsoft-shake.ch - JBoss AS 7, la révolution
soft-shake.ch - JBoss AS 7, la révolution
 
JavaServer Pages
JavaServer PagesJavaServer Pages
JavaServer Pages
 

More from reynolds

America chooses barack obama
America chooses barack obamaAmerica chooses barack obama
America chooses barack obamareynolds
 
Obama Biden
Obama BidenObama Biden
Obama Bidenreynolds
 
Vote For The Barack Obama
Vote For The Barack ObamaVote For The Barack Obama
Vote For The Barack Obamareynolds
 
Barack Obama
Barack ObamaBarack Obama
Barack Obamareynolds
 
Vote For Change
Vote For ChangeVote For Change
Vote For Changereynolds
 
Barack Obama
Barack ObamaBarack Obama
Barack Obamareynolds
 
ObamaShirts
ObamaShirtsObamaShirts
ObamaShirtsreynolds
 
Obama+Presidential+Seal
Obama+Presidential+SealObama+Presidential+Seal
Obama+Presidential+Sealreynolds
 
Barack Obama Phots Gallery
Barack Obama Phots GalleryBarack Obama Phots Gallery
Barack Obama Phots Galleryreynolds
 
Barack Obama
Barack ObamaBarack Obama
Barack Obamareynolds
 
Canstruction
CanstructionCanstruction
Canstructionreynolds
 
Some Of The Beautiful Temples Of The World
Some Of The Beautiful Temples Of The WorldSome Of The Beautiful Temples Of The World
Some Of The Beautiful Temples Of The Worldreynolds
 
Learn to live
Learn to liveLearn to live
Learn to livereynolds
 
MANAGING RISK IN INTERNATIONAL BUSINESS
MANAGING RISK IN INTERNATIONAL BUSINESSMANAGING RISK IN INTERNATIONAL BUSINESS
MANAGING RISK IN INTERNATIONAL BUSINESSreynolds
 
Artistic Airplanes
Artistic AirplanesArtistic Airplanes
Artistic Airplanesreynolds
 
America The Beautiful
America The BeautifulAmerica The Beautiful
America The Beautifulreynolds
 
Web 20 Business Models
Web 20 Business ModelsWeb 20 Business Models
Web 20 Business Modelsreynolds
 
Girls Just Wanna Have Fun
Girls Just Wanna Have FunGirls Just Wanna Have Fun
Girls Just Wanna Have Funreynolds
 
Fattest Athlete In The World
Fattest Athlete In The WorldFattest Athlete In The World
Fattest Athlete In The Worldreynolds
 

More from reynolds (20)

America chooses barack obama
America chooses barack obamaAmerica chooses barack obama
America chooses barack obama
 
Obama Biden
Obama BidenObama Biden
Obama Biden
 
Vote For The Barack Obama
Vote For The Barack ObamaVote For The Barack Obama
Vote For The Barack Obama
 
Barack Obama
Barack ObamaBarack Obama
Barack Obama
 
Vote For Change
Vote For ChangeVote For Change
Vote For Change
 
Barack Obama
Barack ObamaBarack Obama
Barack Obama
 
ObamaShirts
ObamaShirtsObamaShirts
ObamaShirts
 
Obama+Presidential+Seal
Obama+Presidential+SealObama+Presidential+Seal
Obama+Presidential+Seal
 
Barack Obama Phots Gallery
Barack Obama Phots GalleryBarack Obama Phots Gallery
Barack Obama Phots Gallery
 
Barack Obama
Barack ObamaBarack Obama
Barack Obama
 
Canstruction
CanstructionCanstruction
Canstruction
 
Some Of The Beautiful Temples Of The World
Some Of The Beautiful Temples Of The WorldSome Of The Beautiful Temples Of The World
Some Of The Beautiful Temples Of The World
 
Learn to live
Learn to liveLearn to live
Learn to live
 
MANAGING RISK IN INTERNATIONAL BUSINESS
MANAGING RISK IN INTERNATIONAL BUSINESSMANAGING RISK IN INTERNATIONAL BUSINESS
MANAGING RISK IN INTERNATIONAL BUSINESS
 
Artistic Airplanes
Artistic AirplanesArtistic Airplanes
Artistic Airplanes
 
America The Beautiful
America The BeautifulAmerica The Beautiful
America The Beautiful
 
Good Life
Good LifeGood Life
Good Life
 
Web 20 Business Models
Web 20 Business ModelsWeb 20 Business Models
Web 20 Business Models
 
Girls Just Wanna Have Fun
Girls Just Wanna Have FunGirls Just Wanna Have Fun
Girls Just Wanna Have Fun
 
Fattest Athlete In The World
Fattest Athlete In The WorldFattest Athlete In The World
Fattest Athlete In The World
 

Recently uploaded

Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 

Recently uploaded (20)

Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 

Jsf Online F

  • 1. Subscribe Now for FREE! refcardz.com tech facts at your fingertips CONTENTS INCLUDE: JavaServer Faces n Development Process n Lifecycle n Faces-config.xml n The JSF Expression Language JSF Core Tags By Cay S. Horstmann n n JSF HTML Tags and more... These common tasks give you a crash course into using JSF. AbOUT ThIS REfCARD Text field JavaServer Faces (JSF) is the “official” component-based page.jspx view technology in the Java EE web tier. JSF includes a set <h:inputText value=quot;#{bean1.luckyNumber}quot;> of predefined UI components, an event-driven programming model, and the ability to add third-party components. JSF faces-config.xml <managed-bean> is designed to be extensible, easy to use, and toolable. This <managed-bean-name>bean1</managed-bean-name> refcard describes the JSF development process, standard JSF <managed-bean-class>com.corejsf.SampleBean</ tags, the JSF expression language, and the faces-config.xml managed-bean-class> configuration file. <managed-bean-scope>session</managed-bean-scope> </managed-bean> DEvELOpmENT pROCESS com/corejsf/SampleBean.java public class SampleBean { public int getLuckyNumber() { ... } A developer specifies JSF components in JSF pages, public void setLuckyNumber(int value) { ... } combining JSF component tags with HTML and CSS for styling. ... Components are linked with managed beans—Java classes } that contain presentation logic and connect to business logic and persistence backends. Entries in faces-config.xml contain Button www.dzone.com navigation rules and instructions for loading managed beans. page.jspx <h:commandButton value=quot;press mequot; action=quot;#{bean1. servlet container login}quot;/> client devices web application faces-config.xml presentation application logic business logic <navigation-rule> navigation validation <navigation-case> database event handling <from-outcome>success</from-outcome> JSF Pages Managed Beans <to-view-id>/success.jspx</to-view-id> </navigation-case> web service <navigation-case> JSF framework <from-outcome>error</from-outcome> <to-view-id>/error.jspx</to-view-id> <redirect/> </navigation-case> A JSF page has the following structure: </navigation-rule> JSP Style Proper XML → <html> <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <%@ taglib <jsp:root xmlns:jsp=quot;http://java.sun.com/ uri=quot;http:// JSP/Pagequot; java.sun.com/jsf/ xmlns:f=quot;http://java.sun.com/jsf/corequot; corequot; xmlns:h=quot;http://java.sun.com/jsf/htmlquot; prefix=quot;fquot; %> version=quot;2.0quot;> <jsp:directive.page contentType=quot;text/ <%@ taglib html;charset=UTF-8quot;/> JavaServer Faces uri=quot;http:// <jsp:output omit-xml-declaration=quot;noquot; java.sun.com/jsf/ doctype-root-element=quot;htmlquot; htmlquot; doctype-public=quot;-//W3C//DTD XHTML 1.0 prefix=quot;hquot; %> Transitional//ENquot; <f:view> doctype-system=quot;http://www.w3.org/TR/ <head> xhtml1/ <title>...</ DTD/xhtml1-transitional.dtdquot;/> title> <f:view> </head> <html xmlns=quot;http://www.w3.org/1999/ <body> xhtmlquot;> <h:form> <head> ... <title>...</title> </h:form> </head> <body> </body> <h:form>...</h:form> </f:view> </body> </html> </html> </f:view> </jsp:root> DZone, Inc. | www.dzone.com
  • 2. 2 JavaServer Faces tech facts at your fingertips Button, continued ... <h:outputText value=quot;#{msgs.goodbye}!quot; com/corejsf/SampleBean.java styleClass=quot;goodbyequot;> public class SampleBean { ... public String login() { if (...) return </body> quot;successquot;; else return quot;errorquot;; } ... faces-config.xml } <application> <resource-bundle> Radio buttons <base-name>com.corejsf.messages</base-name> page.jspx <var>msgs</var> <h:selectOneRadio value=quot;#{form.condiment}> </resource-bundle> <f:selectItems value=quot;#{form.condimentItems}quot;/> </application> </h:selectOneRadio> com/corejsf/messages.properties com/corejsf/SampleBean.java goodbye=Goodbye public class SampleBean { com/corejsf/messages_de.properties private Map<String, Object> condimentItem = null; public Map<String, Object> getCondimentItems() { goodbye=Auf Wiedersehen if (condimentItem == null) { styles.css condimentItem = new LinkedHashMap<String, Object>(); .goodbye { condimentItem.put(quot;Cheesequot;, 1); // label, value font-style: italic; condimentItem.put(quot;Picklequot;, 2); font-size: 1.5em; ... color: #eee; } } return condimentItem; } Table with links public int getCondiment() { ... } Name public void setCondiment(int value) { ... } Washington, George Delete ... Jefferson, Thomas Delete } Lincoln, Abraham Delete Validation and Conversion Roosevelt, Theodore Delete page.jspx page.jspx <h:inputText value=quot;#{payment.amount}quot; <h:dataTable value=quot;#{bean1.entries}quot; var=quot;rowquot; required=quot;truequot;> styleClass=quot;tablequot; rowClasses=quot;even,oddquot;> <f:validateDoubleRange maximum=quot;1000quot;/> <h:column> </h:inputText> <f:facet name=quot;headerquot;> <h:outputText value=quot;#{payment.amount}quot;> <h:outputText value=quot;Namequot;/> <f:convertNumber type=quot;currencyquot;/> </f:facet> <!-- number displayed with currency symbol and <h:outputText value=quot;#{row.name}quot;/> group separator: $1,000.00 --> </h:column> </h:outputText> <h:column> <h:commandLink value=quot;Deletequot; action=quot;#{bean1. Error Messages deleteAction}quot; immediate=quot;truequot;> <f:setPropertyActionListener target=quot;#{bean1. idToDelete}quot; value=quot;#{row.id}quot;/> page.jspx </h:commandLink> <h:outputText value=quot;Amountquot;/> </h:column> </h:dataTable> <h:inputText id=quot;amountquot; label=quot;Amountquot; value=quot;#{payment.amount}quot;/> com/corejsf/SampleBean.java <!-- label is used in message text --> public class SampleBean { <h:message for=quot;amountquot;/> private int idToDelete; Resources and Styles public void setIdToDelete(int value) {idToDelete = value; } page.jspx public String deleteAction() { <head> // delete the entry whose id is idToDelete <link href=quot;styles.cssquot; rel=quot;stylesheetquot; return null; type=quot;text/cssquot;/> } ... public List<Entry> getEntries() {...} </head> ... <body> } DZone, Inc. | www.dzone.com
  • 3. 3 JavaServer Faces tech facts at your fingertips LIfECyCLE web.xml response complete response complete <?xml version=quot;1.0quot;?> <web-app xmlns=quot;http://java.sun.com/xml/ns/javaeequot; request Restore Apply Request Process Process Process View Values events Validations events xmlns:xsi=quot;http://www.w3.org/2001/XMLSchemainstancequot; xsi:schemaLocation=quot;http://java.sun.com/xml/ns/javaee render response http://java.sun.com/xml/ns/javaee/web-app_2_5.xsdquot; response complete response complete version=quot;2.5quot;> <servlet> Render Process Invoke Process Update response Model <servlet-name>Faces Servlet</servlet-name> Response events Application events Values <servlet-class>javax.faces.webapp.FacesServlet</ conversion errors/render response servlet-class> validation or conversion errors/render response <load-on-startup>1</load-on-startup> </servlet> <!-- Add this element to change the extension for faces-config.xml JSF page files (Default: .jsp) --> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param- The faces-config.xml file contains a sequence of the following name> entries. <param-value>.jspx</param-value> n managed-bean </context-param> 1. description , display-name, icon (optional) <servlet-mapping> 2. managed-bean-name <servlet-name>Faces Servlet</servlet-name> 3. managed-bean-class <url-pattern>*.faces</url-pattern> 4. managed-bean-scope 5. managed-property (0 or more, other optional choices <!-- Another popular URL pattern is /faces/* --> are map-entries and list-entries which are not </servlet-mapping> shown here) <welcome-file-list> 1. description, display-name, icon (optional) <welcome-file>index.faces</welcome-file> 2. property-name <!-- Create a blank index.faces (in addition to 3. value (other choices are null-value, map-entries, index.jspx) --> list-entries which are not shown here) <welcome-file>index.html</welcome-file> n navigation-rule <!-- Use <meta http-equiv=quot;Refreshquot; content= 1. description, display-name, icon (optional) quot;0; URL=index.facesquot;/> --> 2. from-view-id (optional, can use wildcards) </welcome-file-list> 3. navigation-case (1 or more) </web-app> n from-action (optional, not common) n from-outcome n to-view-id ThE JSf ExpRESSION LANgUAgE (EL) n application An EL expression is a sequence of literal strings and expressions m resource-bundle of the form base[expr1][expr2]... As in JavaScript, you 1. base-name can write base.identifier instead of base['identifier'] or 2. var m action-listener, default-render-kit-id, base[quot;identifierquot;]. The base is one of the names in the table resource-bundle, view-handler, state-manager, el- below or a name defined in faces-config.xml. resolver, property-resolver, variable-resolver, header A Map of HTTP header parameters, containing only the first application-extension (details not shown) value for each name. headerValues A Map of HTTP header parameters, yielding a String[] array of n converter all values for a given name. m converter-id param A Map of HTTP request parameters, containing only the first m converter-class value for each name. m Optional initialization (not shown here) paramValues A Map of HTTP request parameters, yielding a String[] array of all values for a given name. n validator cookie A Map of the cookie names and values of the current request. m validator-id initParam A Map of the initialization parameters of this web application. m validator-class requestScope A Map of all request scope attributes. m Optional initialization (not shown here) sessionScope A Map of all session scope attributes. n lifecycle applicationScope A Map of all application scope attributes. m phase-listener facesContext The FacesContext instance of this request. n component, factory, referenced-bean, render-kit, view The UIViewRoot instance of this request. faces-config-extension (details not shown) DZone, Inc. | www.dzone.com
  • 4. 4 JavaServer Faces tech facts at your fingertips The JSF Expression Language (EL), continued JSF Core Tags, continued There are two expression types: Tag Description/ Attributes n Value expression: a reference to a bean property or an f:convertNumber Adds a number converter to a component type number (default), currency , or entry in a map, list, or array. Examples: percent userBean.name calls getName or setName on the userBean pattern Formatting pattern, as defined in java.text.DecimalFormat object maxFractionDigits Maximum number of digits in the pizza.choices[var] calls pizza.getChoices( ).get(var) fractional part or pizza.getChoices( ).put(var, ...) minFractionDigits Minimum number of digits in the fractional part n Method expression: a reference to a method and the maxIntegerDigits Maximum number of digits in the object on which it is to be invoked. Example: integer part minIntegerDigits Minimum number of digits in the userBean.login calls the login method on the userBean integer part object when it is invoked. integerOnly True if only the integer part is parsed (default: false) In JSF, EL expressions are enclosed in #{...} to indicate groupingUsed True if grouping separators are deferred evaluation. The expression is stored as a string and used (default: true) locale Locale whose preferences are to evaluated when needed. In contrast, JSP uses immediate be used for parsing and formatting evaluation, indicated by ${...} delimiters. currencyCode ISO 4217 currency code to use when converting currency values currencySymbol Currency symbol to use when converting currency values JSf CORE TAgS f:validator Adds a validator to a component validatorId The ID of the validator Tag Description/ Attributes f:validateDoubleRange Validates a double or long value, or the length of a string f:view Creates the top-level view f:validateLongRange minimum, maximum the minimum and maximum of the locale The locale for this view. f:validateLength valid rang renderKitId The render kit ID for this view (JSF 1.2) f:loadBundle Loads a resource bundle, stores properties as a Map basename The resource bundle name beforePhase, Phase listeners that are called in afterPhase every phase except quot;restore viewquot; value The name of the variable that is bound to the bundle map f:subview Creates a subview of a view f:selectitems Specifies items for a select one or select many component binding, id, rendered Basic attributes binding, id Basic attributes f:facet Adds a facet to a component value Value expression that points to a SelectItem, an array or Collection of name the name of this facet SelectItem objects, or a Map mapping labels to values. f:attribute Adds an attribute to a component name, value the name and value of the attribute to set f:selectitem Specifies an item for a select one or select many component f:param Constructs a parameter child component binding, id Basic attributes name An optional name for this parameter itemDescription Description used by tools only component. itemDisabled Boolean value that sets the item’s value The value stored in this component. disabled property binding, id Basic attributes itemLabel Text shown by the item itemValue Item’s value, which is passed to the f:actionListener Adds an action listener or value change listener to a server as a request parameter f:valueChangeListener component value Value expression that points to a type The name of the listener class SelectItem instance f:setPropertyChange Adds an action listener to a component that sets a bean f:verbatim Adds markup to a JSF page Listener (JSF 1.2) property to a given value. escape If set to true, escapes <, >, and & characters. Default value is false. value The bean property to set when the action event occurs rendered (JSF 1.2) Basic attributes binding, id The value to set it to f:converter Adds an arbitary converter to a component JSf hTmL TAgS converterId The ID of the converter f:convertDateTime Adds a datetime converter to a component Tag Description type date (default), time, or both h:form HTML form dateStyle default, short, medium, long, or full h:inputText Single-line text input control timeStyle default, short, medium, long, or full h:inputTextarea Multiline text input control pattern Formatting pattern, as defined in java. text.SimpleDateFormat h:inputSecret Password input control locale Locale whose preferences are to be used for parsing and formatting h:inputHidden Hidden field timezone Time zone to use for parsing and formatting h:outputLabel Label for another component for accessibility → DZone, Inc. | www.dzone.com
  • 5. 5 JavaServer Faces tech facts at your fingertips JSF HTML tags, continued Attributes for h:inputText , h:inputSecret, h:inputTextarea , Tag Description and h:inputHidden h:outputLink HTML anchor Attribute Description cols For h:inputTextarea only—number of columns h:outputFormat Like outputText, but formats compound immediate Process validation early in the life cycle messages redisplay For h:inputSecret only—when true, the input h:outputText Single-line text output field’s value is redisplayed when the web page is reloaded h:commandButton Button: submit, reset, or pushbutton required Require input in the component when the form is submitted h:commandLink Link that acts like a register rows For h:inputTextarea only—number of rows pushbutton. valueChangeListener A specified listener that’s notified of value changes h:message Displays the most recent Amount too much message for a component Amount:'too much' is not a binding, converter, id, rendered, Basic attributes number. required, styleClass, value, Example: 99 validator h:messages Displays all messages accesskey, alt, dir, HTML 4.0 pass-through attributes—alt, maxlength, disabled, lang, maxlength, and size do not apply to h:inputTextarea. None readonly, size, style, apply to h:inputHidden tabindex, title h:grapicImage Displays an image onblur, onchange, onclick, DHTML events. None apply to h:inputHidden ondblclick, onfocus, onkeydown, onkeypress, h:selectOneListbox Single-select listbox onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onselect h:selectOneMenu Single-select menu Attributes for h:outputText and h:outputFormat Attribute Description h:selectOneRadio Set of radio buttons escape If set to true, escapes <, >, and & characters. Default value is true. h:selectBooleanCheckbox Checkbox binding, converter, id, rendered, Basic at tributes styleClass, value h:selectManyCheckbox Multiselect listbox style, title HTML 4.0 h:selectManyListbox Multiselect listbox Attributes for h:outputLabel Attribute Description h:selectManyMenu Multiselect menu for The ID of the component to be labeled. h:panelGrid HTML table binding, converter, id, rendered, Basic attributes value h:panelGroup Two or more components that are laid out as one h:dataTable A feature-rich table component h:column Column in a data table Attributes for h:graphicImage Attribute Description Basic Attributes binding, id, rendered, styleClass, value Basic attributes Attribute Description alt, dir, height, ismap, lang, longdesc, style, HTML 4.0 title, url, usemap, width id Identifier for a component onblur, onchange, onclick, ondblclick, onfocus, DHTML events binding Reference to the component that can be used in a backing onkeydown, onkeypress, onkeyup, onmousedown, bean onmousemove, onmouseout, onmouseover, rendered A boolean; false suppresses rendering onmouseup styleClass Cascading stylesheet (CSS) class name value A component’s value, typically a value binding Attributes for h:commandButton valueChangeListener A method binding to a method that responds to value and h:commandLink changes Attribute Description converter Converter class name validator Class name of a validator that’s created and attached to a action If specified as a string: Directly specifies an component outcome used by the navigation handler to determine the JSF page to load next as a result required A boolean; if true, requires a value to be entered in the of activating the button or link If specified as a associated field method binding: The method has this signature: String methodName(); the string represents the outcome Attributes for h:form actionListener A method binding that refers to a method with this signature: void methodName(ActionEvent) Attribute Description charset For h:commandLink only—The character binding, id, rendered, styleClass Basic attributes encoding of the linked reference image For h:commandButton only—A context-relative accept, acceptcharset, dir, enctype, lang, HTML 4.0 attributes path to an image displayed in a button. If you style, target, title (acceptcharset corresponds to specify this attribute, the HTML input’s type will HTML accept-charset) be image. onblur, onchange, onclick, ondblclick, onfocus, DHTML events immediate A boolean. If false (the default), actions and action onkeydown, onkeypress, onkeyup, onmousedown, listeners are invoked at the end of the request onmousemove, onmouseout, onmouseover, onreset, life cycle; if true, actions and action listeners are onsubmit invoked at the beginning of the life cycle. DZone, Inc. | www.dzone.com
  • 6. 6 JavaServer Faces tech facts at your fingertips h:commandButton and h:commandLink , Attributes for h:message and h:messages continued Attribute Description type For h:commandButton: The type of Attribute Description the generated input element: button, submit, or reset. The default, unless you for The ID of the component whose message is displayed—applicable specify the image attribute, is submit. For only to h:message h:commandLink: The content type of the linked resource; for example, text/html, image/ errorClass CSS class applied to error messages gif, or audio/basic errorStyle CSS style applied to error messages value The label displayed by the button or link. fatalClass CSS class applied to fatal messages You can specify a string or a value reference expression. fatalStyle CSS style applied to fatal messages accesskey, alt, binding, id, lang, Basic attributes globalOnly Instruction to display only global messages—applicable only to rendered, styleClass, value h:messages. Default: false coords (h:commandLink only), dir, HTML 4.0 disabled (h:commandButton only), infoClass CSS class applied to information messages hreflang (h:commandLink only), lang, readonly, rel (h:commandLink infoStyle CSS style applied to information messages only), rev (h:commandLink only), layout Specification for message layout: table or list—applicable only shape (h:commandLink only), style, to h:messages tabindex, target (h:commandLink only), title, type showDetail A boolean that determines whether message details are shown. onblur, onchange, onclick, DHTML events Defaults are false for h:messages, true for h:message ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, showSummary A boolean that determines whether message summaries are onmousemove, onmouseout, shown. Defaults are true for h:messages, false for h:message onmouseover, onmouseup, onselect tooltip A boolean that determines whether message details are rendered in a tooltip; the tooltip is only rendered if showDetail and showSummary are true warnClass CSS class for warning messages Attributes for h:outputLink warnStyle CSS style for warning messages Attribute Description binding, id, Basic attributes rendered, accesskey, binding, converter, id, Basic attributes styleClass lang, rendered, styleClass, value style, title HTML 4.0 charset, coords, dir, hreflang, lang, HTML 4.0 rel, rev, shape, style, tabindex, target, title, type Attributes for h:panelGrid onblur, onchange, onclick, ondblclick, DHTML events onfocus, onkeydown, onkeypress, onkeyup, Attribute Description onmousedown, onmousemove, onmouseout, onmouseover, onmouseup bgcolor Background color for the table border Width of the table’s border Attributes for: cellpadding Padding around table cells h:selectBooleanCheckbox , cellspacing Spacing between table cells h:selectManyCheckbox , h:selectOneRadio , columnClasses Comma-separated list of CSS classes for columns h:selectOneListbox , h:selectManyListbox , columns Number of columns in the table h:selectOneMenu , h:selectManyMenu footerClass CSS class for the table footer frame Specification for sides of the frame surrounding the table that are to be drawn; valid values: none, above, below, hsides, vsides, lhs, rhs, box, border Attribute Description headerClass CSS class for the table header disabledClass CSS class for disabled elements—for h:selectOneRadio and h:selectManyCheckbox rowClasses Comma-separated list of CSS classes for columns only rules Specification for lines drawn between cells; valid values: groups, rows, columns, all enabledClass CSS class for enabled elements—for h:selectOneRadio and h:selectManyCheckbox summary Summary of the table’s purpose and structure used for only non-visual feedback such as speech layout Specification for how elements are laid out: binding, id, rendered, Basic attributes lineDirection (horizontal) or pageDirection styleClass, value (vertical)—for h:selectOneRadio and h:selectManyCheckbox only dir, lang, style, HTML 4.0 title, width binding, converter, id, Basic attributes immediate, styleClass, onclick, ondblclick, DHTML events required, rendered, onkeydown, onkeypress, validator, value, onkeyup, onmousedown, valueChangeListener onmousemove, onmouseout, accesskey, border, dir, HTML 4.0—border is applicable to onmouseover, disabled, lang, readonly, h:selectOneRadio and h:selectManyCheckbox onmouseup style, size, tabindex, only. size is applicable to h:selectOneListbox and title h:selectManyListbox only onblur, onchange, onclick, ondblclick, onfocus, DHTML events Attributes for h:panelGroup onkeydown, onkeypress, onkeyup, onmousedown, Attribute Description onmousemove, onmouseout, binding, id, rendered, Basic attributes onmouseover, onmouseup, styleClass onselect style HTML 4.0 DZone, Inc. | www.dzone.com
  • 7. 7 JavaServer Faces tech facts at your fingertips Attributes for h:dataTable Attributes for h:dataTable , continued Attribute Description Attribute Description bgcolor Background color for the table var The name of the variable created by the data table that represents the current item in the value border Width of the table’s border binding, id, rendered, Basic attributes cellpadding Padding around table cells styleClass, value cellspacing Spacing between table cells dir, lang, style, title, HTML 4.0 columnClasses Comma-separated list of CSS classes for columns width first Index of the first row shown in the table onclick, ondblclick, DHTML events onkeydown, onkeypress, footerClass CSS class for the table footer onkeyup, onmousedown, frame Frame Specification for sides of the frame surrounding the onmousemove, onmouseout, table that are to be drawn; valid values: none, above, below, onmouseover, onmouseup hsides, vsides, lhs, rhs, box, border headerClass CSS class for the table header Attributes for h:column rowClasses Comma-separated list of CSS classes for rows Attribute Description rules Specification for lines drawn between cells; valid values: headerClass (JSF 1.2) CSS class for the column's header groups, rows, columns, all footerClass (JSF 1.2) CSS class for the column's footer summary Summary of the table's purpose and structure used for non- visual feedback such as speech binding, id, rendered Basic attributes AbOUT ThE AUThOR RECOmmENDED bOOK Cay S. Horstmann Core JavaServer Faces Cay S. Horstmann has written many books on C++, Java and object- oriented development, is the series editor for Core Books at Prentice-Hall delves into all facets of and a frequent speaker at computer industry conferences. For four years, JSF development, offering Cay was VP and CTO of an Internet startup that went from 3 people in a systematic best practices for tiny office to a public company. He is now a computer science professor building robust applications at San Jose State University. He was elected Java Champion in 2005. and maximizing developer List of recent books/publications productivity. • Core Java, with Gary Cornell, Sun Microsystems Press 1996 - 2007 (8 editions) • ore JavaServer Faces, with David Geary, Sun Microsystems Press, 2004-2006 (2 editions) C • ig Java, John Wiley & Sons 2001 - 2007 (3 editions) B bUy NOW Blog Web site books.dzone.com/books/jsf http://weblogs.java.net/blog/cayhorstmann http://horstmann.com Want More? Download Now. Subscribe at refcardz.com Upcoming Refcardz: Available: n Core CSS II Published September 2008 Published June 2008 n Ruby n Getting Started with JPA n jQuerySelectors fREE Core CSS I Core CSS III Design Patterns n n n n Struts 2 n SOA Patterns n Flexible Rails: Flex 3 on Rails 2 Published August 2008 n Scalability and High n Very First Steps in Flex Published May 2008 n Agile Methodologies n C# n Windows PowerShell n Groovy Dependency Injection in EJB 3 n Spring Annotations n Core .NET n n PHP Published July 2008 n Core Java n NetBeans IDE 6.1 Java Editor Visit http://refcardz.dzone.com JUnit RSS and Atom for a complete listing of Design Patterns n n GlassFish Application Server available Refcardz. n MySQL n Published June 2008 n Silverlight 2 Seam IntelliJ IDEA n n DZone, Inc. 1251 NW Maynard ISBN-13: 978-1-934238-19-6 Cary, NC 27513 ISBN-10: 1-934238-19-8 50795 888.678.0399 DZone communities deliver over 3.5 million pages per month to 919.678.0300 more than 1.5 million software developers, architects and designers. Refcardz Feedback Welcome DZone offers something for every developer, including news, refcardz@dzone.com $7.95 tutorials, blogs, cheatsheets, feature articles, source code and more. Sponsorship Opportunities 9 781934 238196 “DZone is a developer’s dream,” says PC Magazine. sales@dzone.com Copyright © 2008 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, Version 1.0 photocopying, or otherwise, without prior written permission of the publisher. Reference: Core JavaServer Faces, David Geary and Cay S. Horstmann, Sun Microsystems Press, 2004-2006.