Monday, February 16, 2009

More JSF

Inverting the bean value requires the ! (or not) operator:
<h:inputtext rendered="#{!bean.hide}">

You can concatenate plain strings and value binding expressions, simply by placing them next to each other. Consider, for example,
<h:outputtext value="#{messages.greeting}, #{user.name}!">

Here is a typical use of a method binding expression.
<h:commandbutton action="#{user.checkPassword}">


The h:dataTable tag iterates over data to create an HTML table. Here's how you use it:
<h:datatable value="#{items}" var="item"><h:datatable value="#{items}" var="item">
The value attribute represents the data over which h:dataTable iterates; that data must be one of the following:
  • an array

  • an instance of java.util.List

  • an instance of java.sql.ResultSet

  • an instance of javax.servlet.jsp.jstl.sql.Result

  • an instance of javax.faces.model.DataModel

No comments: