protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
// 设置响应内容类型
response.setHeader("Cache-Control", "no-cache");
response.setContentType("application/json;charset=UTF-8");
PrintWriter out = response.getWriter();
JSONObject jsonobj = new JSONObject();
String menu_name = request.getParameter("menu_name") == null ? "" : request.getParameter("menu_name");
int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
int pagesize = request.getParameter("pagesize") == null ? 5 : Integer.parseInt(request.getParameter("pagesize"));
MenuService menuService = new MenuService();
ArrayList<Menu> arr = menuService.selectByPage(menu_name, page, pagesize);
int rs_count = menuService.selectCount(menu_name);
jsonobj.put("code", 0);
jsonobj.put("message", "OK");
jsonobj.put("Rows", arr);
jsonobj.put("Total", rs_count);
out.println(jsonobj);
}
新蔷程序员特训营,带领初学者快速开发商业项目:https://paishenwx.taobao.com/