114 CHAPTER 3: Best Practices in Java EE Web Development
Using EL
In this section, you will create a simple application based on the model of our bookstore application.
This will not only show you how to use EL but also demonstrate its significance. Figure 3- 5 illustrates
the relationship between Book and Author in the application, implemented in Listings 3-9 and 3-10.
Book Author
*
book Title: Stringname: String
author: Author
Figure 3-5. Relationship between Book and Author
Figure 3-4. Logical operators
Listing 3-9. Author.java
1.package com.apress.chapter03.model;
2.
3.public class Author {
4.private String name;
5.
6.public String getName() {
7.return name;
8.}
9.
10.public void setName(String name) {
11.this.name = name;
12.}
13.
14.}
Listing 3-10. Book.java
1.package com.apress.chapter03.model;
2.
3.public class Book {
4.
5.private String bookTitle;
6.private Author author;
7.
8.public String getBookTitle() {