Learn Java for Web Development

(Tina Meador) #1

296 CHAPTER 6: Component-Based Web Development Using JSF 2


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">


























   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">


























   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">

Free download pdf