package cn.edu.cg.controller; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cn.edu.cg.dao.BookDaoImpl; import cn.edu.cg.domain.Book; @WebServlet("/ListBookServlet") public class ListBookServlet extends HttpServlet { private static final long serialVersionUID = 1L; 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"); BookDaoImpl bookDao=new BookDaoImpl(); List<Book> books = bookDao.getAll(); request.setAttribute("books", books); request.getRequestDispatcher("/listbook.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }

微信网友_7309216833228800 LV1
2024年12月23日
592132324 LV4
2024年12月11日
2411307984 LV1
2024年5月10日
baining LV1
2024年5月8日
taoshen95 LV16
2024年3月22日
zeng1206 LV7
2023年12月25日
周博宇 LV1
2023年11月27日
paolanya LV2
2023年11月13日
abandan LV4
2023年11月5日
hongdongdong LV14
2023年10月28日

周 敬博 LV2
2月18日
微信网友_7313058229293056
2024年12月26日
暂无贡献等级
微信网友_7309216833228800 LV1
2024年12月23日
592132324 LV4
2024年12月11日
小黄同学 LV8
2024年9月29日
cong58cong LV8
2024年6月26日
liyan54188 LV2
2024年6月25日
TY0165 LV20
2024年6月25日
微信网友_7043154826989568 LV1
2024年6月18日
李嘉宝 LV1
2024年6月18日