Learn Java for Web Development

(Tina Meador) #1

94 CHAPTER 2: Building Web Applications Using Servlets and JSP


Note The JSP page in Listing 2-31 uses scriptlets and expressions to obtain the categories and display them.
Using scriptlets and expressions are bad practices and should be avoided as much as possible. This is the
subject of the next chapter, which will show you how to replace scriptlets and expressions with JSTL and EL.

Step 6: Sending the Response

The view constructed in the previous step is delivered to the browser.


Listing All the Books

When the user clicks All Books on the menu, the list of all books is displayed, as illustrated in
Figure 2-37.


Figure 2-37. Listing all books


The All Books link is in the leftColumn.jsp file. Listing 2-32 illustrates the code fragment for the All
Books link on the menu.

Free download pdf