第二阶段团队冲刺第五天
从书架删除书籍的功能
点击长按该书籍
成功实现从书架删除书籍的功能
package Servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dao.dao; import entity.Book; import entity.Bookshelf; import net.sf.json.JSONObject; public class DeleteBookshelfServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html; charset=utf-8"); String username=request.getParameter("username"); String bookname =request.getParameter("BookName"); Bookshelf bookshelf =new Bookshelf(bookname,username); dao dao =new dao(); PrintWriter out = response.getWriter(); JSONObject json=new JSONObject(); if(dao.deleteshelf(bookshelf)) { json.put("result", 1); out.print(json); }else { json.put("result", 0); out.print(json); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } } DeleteBookshelfServlet