Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Using the jsfc attribute


Facelets comes with an attribute named jsfc. Its main goal consists in converting HTML elements in JSF components (the HTML prototype in the JSF page). For example, in the following code, we have an HTML form converted into a JSF form:

<form jsfc="h:form">
  <input type="text" jsfc="h:inputText" value="#{nameBean.name}" />
  <input type="submit" jsfc="h:commandButton" value="Send"/>
</form>

This attribute stands for fast prototyping and is easy to use. The following is another example—this time the jsfc attribute is combined with <ui:repeat> for generating a <table> tag:

<table>
  <thead>
    <tr>
      <th>Ranking</th>
      <th>Player</th>
      <th>Age</th>
      <th>Coach</th>
    </tr>
  </thead>
  <tbody>
    <tr jsfc="ui:repeat" value="#{playersBean.dataArrayList}" var="t">
      <td>#{t.ranking}</td>
      <td>#{t.player...