CHAPTER 5: Building Java Web Applications with Spring Web MVC 255
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
bookList.add(book1);
bookList.add(book2);
}
public List
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
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
- <!DOCTYPE html>
Your Book store
Books List
Author
Book Title