www.pudn.com > bookshop.zip > BookListServlet.java, change:2013-07-07,size:774b


package com.tarena.web; 
 
import java.io.IOException; 
import java.io.PrintWriter; 
import java.util.ArrayList; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import com.tarena.dao.BookDao; 
 
public class BookListServlet extends HttpServlet { 
 
	 
	public void service(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException { 
 
		//调用BookDao获得结果集 
		//将Arraylist结果集重定向到Booklistservlet 
		BookDao bd = new BookDao(); 
		ArrayList albooks = bd.getbooks(); 
		request.setAttribute("bk",albooks); 
		request.getRequestDispatcher("booklist.jsp").forward(request,response); 
	} 
 
}