Java Reference
In-Depth Information
Listing 6-23 illustrates the code for Figure
6-19
.
Listing 6-23. home.xhtml
1. <?xml version="1.0" encoding="UTF-8"?>
2. <!DOCTYPE html>
3. <html xmlns="
http://www.w3.org/1999/xhtml
"
4. xmlns:h="
http://java.sun.com/jsf/html
"
5. xmlns:ui="
http://java.sun.com/jsf/facelets
">
6. <h:body>
7. <ui:composition template="templates/common.xhtml">
8. <ui:define name="content">
9. <ui:include src="/contents.xhtml" />
10. </ui:define>
11. </ui:composition>
12. </h:body>
13. </html>
Line 9
: The usage of the
ui:include
tag for the inclusion of
contents.xhtml
When the user clicks All Books in the sidebar of the home page, the list of all books is displayed, as
illustrated in Figure
6-20
.
Listing 6-24 and Listing 6-25 illustrate the code for Figure
6-20
.
Listing 6-24. bookList.html
1. <?xml version="1.0" encoding="UTF-8"?>
2. <!DOCTYPE html>
3. <html xmlns="
http://www.w3.org/1999/xhtml
"
4. xmlns:h="
http://java.sun.com/jsf/html
"
5. xmlns:ui="
http://java.sun.com/jsf/facelets
">
6. <h:body>
7. <ui:composition template="templates/common.xhtml">
8. <ui:define name="content">
9. <ui:include src="/list.xhtml" />
10. </ui:define>
11. </ui:composition>
12. </h:body>
13. </html>
Line 9
: The usage of the
ui:include
tag for the inclusion of
list.xhtml
Listing 6-25 illustrates the
list.xhtml
file for the list of the books displayed in Figure
6-20
.
Listing 6-25. list.xhtml
1. <?xml version="1.0" encoding="UTF-8"?>
2. <!DOCTYPE html>
3. <html xmlns="
http://www.w3.org/1999/xhtml
"
4. xmlns:h="
http://java.sun.com/jsf/html
"
5. xmlns:ui="
http://java.sun.com/jsf/facelets
"
6. xmlns:f="
http://java.sun.com/jsf/core
"
>