日期:2014-05-16 浏览次数:20317 次
package servlet.user; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dao.DBOperation; import util.Validate; public class BookinfServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Validate vd = new Validate(); int id = Integer.parseInt(request.getParameter("bookId")); DBOperation dbo=new DBOperation(); String sql = "select * from books where id='" + id + "'"; request.setAttribute("bookinf", dbo.queryReturnList(sql)); String str = "/user/bookDetail.jsp"; RequestDispatcher rd = request.getRequestDispatcher(str); rd.forward(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }