Java Reference
In-Depth Information
author1.setAuthorName("Vishal Layka");
Book book1 = new Book();
book1.setBookId((long) 1);
book1.setBookTitle("Beginning Groovy, Grails and Griffon");
book1.setAuthor(author1);
Book book2 = new Book();
book2.setBookId((long) 2);
book2.setBookTitle("Modern Java Web Development");
book2.setAuthor(author1);
bookList = new LinkedList<Book>();
bookList.add(book1);
bookList.add(book2);
}
public List<Book> getBookList() {
return bookList;
}
public Book createBook(Book b) {
Book book = new Book();
book.setBookId((long)bookList.size() + 1);
book.setAuthor(b.getAuthor());
book.setBookTitle(b.getBookTitle());
bookList.add(book);
return book;
}
}
Listing 5-48 illustrates the modified bookList.jsp of the bookstore application for form processing.
Listing 5-48. bookList.jsp
1. <%@page contentType="text/html" pageEncoding="UTF-8"%>
2. <%@ taglib prefix="c" uri=" http://java.sun.com/jsp/jstl/core " %>
3. <!DOCTYPE html>
4. <html>
5. <head>
6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7. <title>Your Book store</title>
8. </head>
9. <body>
10. <h1>Books List</h1>
11. <table border="1">
12. <tr>
13. <th align="left">Author</th>
14. <th align="left">Book Title</th>
15. </tr>
16. <c:forEach items="${bookList}" var="book">
 
Search WWH ::




Custom Search