A basic JSF example
We have covered just enough theory on the JSF framework. I think it is time for my readers to see some code. The first code is the XHTML file to display a basic web page on a site. The source code is available on the book's website in the author's public GitHub account at http://github.com/peter_pilgrim/digital_javaee7.
Here is the XHTML source code for the initial Facelets view, and the file is called index.xhtml
:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:head> <title>Digital Java EE 7 - Sample JSF</title> </h:head> <h:body> This is the simplest JSF example possible. <h:form> <h:commandButton...