Java Reference
In-Depth Information
</tr>
</tbody>
</table>
</form>
</body>
</html>
To make JSF interpret HTML tags, we need to add at least one JSF-specific
attribute to the tag—any JSF-specific attribute will do. These tags are defined in the
xmlns:jsf= "http://xmlns.jcp.org/jsf"
namespace, which we need to add to
the page.
In our example, we transformed an HTML form into a JSF form by adding the
jsf:id
and
jsf:prependId
attributes to the
<form>
tag. To every input field, we
added a
jsf:id
and
jsf:value
attribute. These JSF specific attributes let JSF know
that these tags should be treated as their JSF equivalents.
We can see in the preceding markup that we used JSF-specific
<f:selectItem>
tags to set the options of our dropdown. One disadvantage of JSF HTML5-friendly
markup is that
<option>
tags inside a
<select>
tag are not interpreted correctly,
so we still need to use
<f:selectItem>
to set the options of a dropdown.
When we execute our code, we can see our page rendered in the browser.