JSF Code - Annotated 3
[Previous] [Main] [Next]

More of the JSF Code


<body>
<h:form>
<h3>Please enter your name and password.</h3>

More of this code is standard HTML.

1. <h:form> This will create a form in the final HTML. The form will be named, given the "POST" method, and associated with a specific URL.

<form id="_id0" method="post" action="/login/index.faces" enctype="application/x-www-form-urlencoded">  
...  
<input type="hidden" name="_id0" value="_id0"></form>  
 
2. Note the id given to this form - "_id0." This is the format of default names. Also note that there is a hidden field that supplies the name of this form back to the Faces Servlet Container.  
 
3. Note: the URL is "index.faces." There is no file on the server named "index.faces." I personally hate "magic" command (commands that you must memorize what they really do since they don't do what they seem to do.) Geary and Horstmann call this "Byzantine." So why is it there. The Application Container (i.e. Tomcat) needs to know which JSP pages to serve to the Faces Servlet. There are several ways to configure this, but they all amount to saying "When a user makes a request to something with the following pattern, Tomcat should feed it to the Faces Servlet and Faces will convert it to xzy.jsp."