4. Facelets
JSF 1.x
◦ JSP as their default view technology
◦ Mismatch of lifecycle between JSP &
JSFs
JSF 2.x
◦ Facelets became a de facto standard for
JSF
◦ in Version 2.0 of the JSF specification
5. Resource Location (1/2)
resource directory
◦ at the root of WAR
◦ under META-INF
my war file example:
6. Resource Location (2/2)
my war file example:
In JSF, I retrieve these files:
◦ <h:outputStylesheet library="css" name="styles.css"/>
◦ <h:outputScript library="scripts" name="somescript.js"/>
◦ <h:graphicImage library="images" name="logo.png"/>
18. Look inside the form (2/3)
form does NOT need action and
method
◦ action: generated automatically
◦ method: always post
messages is used to display any
messages
◦ explain latter
panelGrid is like HTML table
◦ NOT declaring rows and columns
◦ declare the number of columns for each
19. Look inside the form (2/3)
Observe the table and the facelet
◦ In panelGrid, one cell for one tag
◦ Use panelGroup to combine tags into 1 cell
Observe the HTML file and the facelet
◦ columnClasses set the CSS class
Invalid data is submitted
◦ required, validateLength chekcs the
inputs
◦ Error message is displayed at messages
Click the label in page
◦ for (outputLabel) <-> id (inputText)
21. Navigation
Valid inputs is submit
1. customer named bean’s is bound
2. To facelet confirmation.xhtml
3. This page also use value binding
expression
Invalid inputs is submit
1. Navigate the same page
2. Show message