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}" ...

Get Mastering JavaServer Faces 2.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.