Display List from Database using Iterate Tag Step 29
You will also want to display the list of books that you have added to the database.
You should add this code to your addbook.jsp page.
<tr><td>
<b>Current Book List</b>
</td></tr>
<nested:iterate property="bookList">
<tr><td>
Book Name:<nested:write property="bookName"/>
</td></tr>
This will list the book names that you have saved to the database.
You should also add this code to your UserForm class. This is where you will store the book list that will be displayed in your JSP page.
private List
public List
{
return bookList;
}
public void setBookList(List
{
this.bookList=bookList;
}
You will want to replace your addBook method with this code. This code will load your books from the database when the user first enters the JSP page.
UserBookService service = ServiceFactory.getInstance().getUserBookService();
List
UserForm userForm=(UserForm)form;
userForm.setBookList(bookList);
System.out.println("in addBook");
return mapping.findForward("addbook");
Go To Step 30

0 comments:
Post a Comment