合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
### 1.公司控制器类 ``` package com.baishenghua200.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 com.baishenghua200.pojo.CompanyInfomation200; import com.baishenghua200.pojo.Menu200; import com.baishenghua200.services.ICompanyInfomationService200; import com.baishenghua200.services.impl.CompanyInfomationServiceImpl200; /** * CompanyInfomationController200.java(公司信息控制器类) * @desc 主要控制公司信息模型数据和视图展示 * @author 柏圣华 * @date 2021-11-22 * */ @WebServlet("/companyInfoController200") public class CompanyInfomationController200 extends HttpServlet { private static final long serialVersionUID = 1L; ICompanyInfomationService200 cis200 = new CompanyInfomationServiceImpl200(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String method = request.getParameter("method"); //method的取值有editCompanyInfo、deleteCompanyInfo、addCompanyInfo、updateCompanyInfo、queryByCon CompanyInfomation200 ci200 = new CompanyInfomation200(); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+" "+"————"); if("addCompanyInfo".equalsIgnoreCase(method)) {//添加导航菜单信息操作 System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+"———— "); ci200.setCiNo200(Integer.parseInt(request.getParameter("ciNo200"))); ci200.setCiTitle200(request.getParameter("ciTitle200")); ci200.setCiImage200(request.getParameter("ciImage200")); ci200.setCiContent200(request.getParameter("ciContent200")); ci200.setCiEditDate200(request.getParameter("ciEditDate200")); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+" ci200 "+ci200); int flag = cis200.add200(ci200); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+" ci200 " +ci200+"——执行cis200.add200方法之后 flag="+flag); queryAll(request,response);//查询所有 }else if("editCompanyInfo".equalsIgnoreCase(method)){ String ciId200 = request.getParameter("ciId200"); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+"—ciId200="+ciId200); ci200.setCiId200(Integer.parseInt(ciId200)); ci200 = cis200.query200(ci200); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if query200()方法"+"—ci200="+ci200); request.setAttribute("ci200", ci200); request.getRequestDispatcher("/Companyinfomanager/EditCompanyInfo200.jsp").forward(request, response);// 转发到EditMenu.jsp页面上去 }else if("updateCompanyInfo".equalsIgnoreCase(method)){ String ciId200 = request.getParameter("ciId200"); ci200.setCiId200(Integer.parseInt(ciId200)); ci200.setCiNo200(Integer.parseInt(request.getParameter("ciNo200"))); ci200.setCiTitle200(request.getParameter("ciTitle200")); ci200.setCiImage200(request.getParameter("ciImage200")); ci200.setCiContent200(request.getParameter("ciContent200")); ci200.setCiEditDate200(request.getParameter("ciEditDate200")); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+" ci200 "+ci200); int flag = cis200.update200(ci200); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+" ci200 " +ci200+"——执行cis200.update200方法之后 flag="+flag); queryAll(request,response);//查询所有 }else if("deleteCompanyInfo".equalsIgnoreCase(method)){ String ciId200 = request.getParameter("ciId200"); ci200.setCiId200(Integer.parseInt(ciId200)); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+"—ciId200="+ciId200); int flag = cis200.delete200(ci200); System.out.println("当前操作的是CompanyInfomationController200,执行"+method+"if"+" ci200 " +ci200+"——执行cis200.delete200方法之后 flag="+flag); queryAll(request,response);//查询所有 }else if("queryByCon".equalsIgnoreCase(method)){ }else if("addPage".equalsIgnoreCase(method)){ request.getRequestDispatcher("/Companyinfomanager/AddCompanyInfo200.jsp").forward(request, response); }else { queryAll(request,response);//查询所有 } } protected void queryAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<CompanyInfomation200> ciList = cis200.queryAll200();// 调用服务层接口实现类的查询所有方法 request.getSession().setAttribute("ciList", ciList);// 把查询出来的导航菜单数据集合放到request里面 request.getRequestDispatcher("/Companyinfomanager/CompanyInfoMain200.jsp").forward(request, response);// 转发到main.jsp页面上去 } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } ``` ### 2.留言控制器类 ``` package com.baishenghua200.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 javax.servlet.http.HttpSession; import com.baishenghua200.pojo.Menu200; import com.baishenghua200.pojo.Message200; import com.baishenghua200.pojo.User200; import com.baishenghua200.services.IMessageService200; import com.baishenghua200.services.impl.MessageServiceImpl200; /** * Servlet implementation class MessageServlet200 */ @WebServlet("/MessageServlet200") public class MessageServlet200 extends HttpServlet { private static final long serialVersionUID = 1L; IMessageService200 ims200 = new MessageServiceImpl200(); public MessageServlet200() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String method = request.getParameter("method"); Message200 msg200 = new Message200(); if("addMessage".equals(method)){ String title200 = request.getParameter("title200"); String content200 = request.getParameter("content200"); HttpSession session = request.getSession(); User200 user200 = (User200)session.getAttribute("user"); msg200.setTitle200(title200); msg200.setContent200(content200); int flag = ims200.add200(msg200); if(1==user200.getId200()){ queryAll(request,response); }else{ request.getRequestDispatcher("index.jsp").forward(request, response); } }else if("editMessage".equals(method)){ String id200 = request.getParameter("id200");//获取main.jsp界面菜单编号的值 msg200.setId200(Integer.parseInt(id200)); msg200 = ims200.query200(msg200);//根据点击main.jsp页面的编辑获取菜单的编号,去数据库表中查询这个菜单信息 request.setAttribute("msg200", msg200);//把数据库表中的menu信息放到request的menu属性里面 request.getRequestDispatcher("/MessageManager/EditMessage200.jsp").forward(request, response);// 转发到EditMenu.jsp页面上去 }else if("deleteMessage".equals(method)){ String id200 = request.getParameter("id200");//获取main.jsp界面菜单编号的值 msg200.setId200(Integer.parseInt(id200)); int flag = ims200.delete200(msg200);//调用服务层接口实现类的删除方法,删除菜单menu200 queryAll(request,response); }else if("updateMessage".equals(method)){ String id200 = request.getParameter("id200");//获取EditMenu.jsp界面菜单编号的值 msg200.setId200(Integer.parseInt(id200)); String title200 = request.getParameter("title200"); String content200 = request.getParameter("content200"); msg200.setTitle200(title200); msg200.setContent200(content200); int flag = ims200.update200(msg200);//调用服务层接口实现类的更新方法,更新菜单menu200 queryAll(request,response); }else if("queryAllMessage".equals(method)){ queryAll(request,response); }else if("addPage".equals(method)){ request.getRequestDispatcher("MessageManager/AddMessage200.jsp").forward(request, response); }else{ queryAll(request,response); } } protected void queryAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<Message200> msgList = ims200.queryAll200();// 调用服务层接口实现类的查询所有方法 request.setAttribute("msgList", msgList);// 把查询出来的导航菜单数据集合放到request里面 request.getRequestDispatcher("MessageManager/MainMessage200.jsp").forward(request, response);// 转发到main.jsp页面上去 } } ``` ### 3.主控制器类 ``` package com.baishenghua200.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 com.baishenghua200.dao.IMenuDao200; import com.baishenghua200.dao.impl.MenuDaoImpl200; import com.baishenghua200.pojo.CompanyInfomation200; import com.baishenghua200.pojo.Menu200; import com.baishenghua200.services.ICompanyInfomationService200; import com.baishenghua200.services.IMenuService200; import com.baishenghua200.services.impl.CompanyInfomationServiceImpl200; import com.baishenghua200.services.impl.MenuServiceImpl200; @WebServlet("/IndexServlet200") public class IndexServlet200 extends HttpServlet { private static final long serialVersionUID = 1L; IMenuService200 ims200 = new MenuServiceImpl200(); ICompanyInfomationService200 cis200 = new CompanyInfomationServiceImpl200(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { queryAll(request,response);//用于查询所有导航菜单信息 //查询合作伙伴 //查询XXXX //查询XXXX //作业 //添加过程描述,页面数据->数据库表中的 //MenuManager文件 //1.在添加页面上Addmenu200.jsp,输入要添加到数据库的数据 //2.看页面AddMenu200.jsp的form里面action的值(MenuServlet200),这个数据下一步要去的地方 //3.把页面上的数据传输给Servlet类MenuServlet200,然后具体做什么操作,由action当中method值来决定。 //4.当前action="MenuServlet200?method=addMenu",method值是addMenu,也就添加 //5.就要执行添加if语句,把页面上的你填充的数据都获取过来,然后构造菜单对象 //6.声明服务层接口类型(IMenuService200)引用ims200,创建对应的服务层接口实现类(MenuServiceImpl200)的实例 //通过引用ims200调用添加方法(ims200.add200(menu200)),返回是否添加成功 //6.1创建对应的服务层接口实现类(MenuServiceImpl200)的实例,声明dao接口类型IMenuDao200 引用imd200, //创建对应的dao接口实现类= new MenuDaoImpl200()的实例, //6.2调用dao接口实现类(MenuServiceImpl200)添加方法,返回是否添加成功 //7.执行完添加之后,会调用查询所有菜单信息的方法,返回到查询界面。 //查询过程描述,请求 ,数据库表中的数据->页面 //1.发送查询所有数据的请求MenuServlet200,或者method=queryAllMenu //2.声明服务层接口类型(IMenuService200)引用ims200,创建对应的服务层接口实现类(MenuServiceImpl200)的实例 //通过引用ims200调用查询方法(ims200.queryAll200(menu200)),返回是导航菜单信息集合(List<Menu200>) //2.1创建对应的服务层接口实现类(MenuServiceImpl200)的实例,声明dao接口类型IMenuDao200 引用imd200, //创建对应的dao接口实现类= new MenuDaoImpl200()的实例, //2.2调用dao接口实现类(MenuServiceImpl200)查询所有方法,返回是导航菜单信息集合(List<Menu200>) //3.把查询出来的导航菜单数据集合放到request里面(request.setAttribute("menus", menusList);) //4.把请求转发到MenuMain200.jsp页面上去(request.getRequestDispatcher("/WEB-INF/MenuManager/MenuMain200.jsp").forward(request, response);) //5.在MenuMain200.jsp页面引入核心标签库,然后通过forEach循环迭代出数据显示在页面上。 //经过哪些页面,经过了哪些类,顺序是什么,大家描述一下,文字描述, } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } /** * 查询所有信息的方法 * @param request 请求 * @param response 响应 * @throws ServletException Servlet异常 * @throws IOException IO异常 */ protected void queryAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<Menu200> menusList = ims200.queryAll200();// 调用服务层接口实现类的查询所有方法 request.getSession().setAttribute("menus", menusList);// 把查询出来的导航菜单数据集合放到session里面 //request.setAttribute("menus", menusList);// 把查询出来的导航菜单数据集合放到request里面 List<CompanyInfomation200> ciList = cis200.queryAll200();// 调用服务层接口实现类的查询所有方法 request.getSession().setAttribute("ciList", ciList);// 把查询出来的导航菜单数据集合放到request里面 System.out.println("ciList:===="+ciList); request.getRequestDispatcher("index200.jsp").forward(request, response);// 转发到index.jsp页面上去 } } ``` ### 4.用户控制器类 ``` package com.baishenghua200.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 com.baishenghua200.pojo.User200; import com.baishenghua200.services.IUserService200; import com.baishenghua200.services.impl.UserServiceImpl200; @WebServlet("/UserServlet200") public class UserServlet200 extends HttpServlet { private static final long serialVersionUID = 1L; IUserService200 ius200 = new UserServiceImpl200(); public UserServlet200() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String method = request.getParameter("method"); //method的取值有editUser、deleteUser、addUser、updateUser、queryAllUser User200 user200 = new User200(); //跳转到添加页面addPage if("addUser".equalsIgnoreCase(method)) { user200.setName200(request.getParameter("name")); user200.setGender200(request.getParameter("gender")); user200.setAge200(Integer.parseInt(request.getParameter("age"))); user200.setAddress200(request.getParameter("address")); user200.setQq200(request.getParameter("qq")); user200.setEmail200(request.getParameter("email")); ius200.add(user200); queryAll(request,response); }else if("queryAllUser".equalsIgnoreCase(method)) { queryAll(request,response); }else if("editUser".equalsIgnoreCase(method)) { String id = request.getParameter("id"); user200 = ius200.findById(Integer.parseInt(id)); request.setAttribute("user", user200); request.getRequestDispatcher("/UserManager/EditUser200.jsp").forward(request, response); }else if("updateUser".equalsIgnoreCase(method)) { String id = request.getParameter("id"); user200.setId200(Integer.parseInt(id)); user200.setName200(request.getParameter("name")); user200.setGender200(request.getParameter("gender")); user200.setAge200(Integer.parseInt(request.getParameter("age"))); user200.setAddress200(request.getParameter("address")); user200.setQq200(request.getParameter("qq")); user200.setEmail200(request.getParameter("email")); ius200.update(user200); queryAll(request,response); }else if("deleteUser".equalsIgnoreCase(method)) { String id = request.getParameter("id"); ius200.delete(Integer.parseInt(id)); queryAll(request,response); }else if("addPage".equalsIgnoreCase(method)) { request.getRequestDispatcher("/UserManager/AddUser200.jsp").forward(request, response); }else { queryAll(request,response); } } protected void queryAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<User200> uList = ius200.findAll(); request.getSession().setAttribute("uList", uList); request.getRequestDispatcher("/UserManager/UserMain200.jsp").forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } ``` ### 5.登录控制器类 ``` package com.baishenghua200.controller; import java.io.IOException; 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 javax.servlet.http.HttpSession; import com.baishenghua200.pojo.User200; import com.baishenghua200.services.IUserService200; import com.baishenghua200.services.impl.UserServiceImpl200; @WebServlet("/LoginServlet200") public class LoginServlet200 extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 2.获取数据 // 2.1获取用户填写验证码 String verifycode = request.getParameter("verifycode"); String username = request.getParameter("username"); String password = request.getParameter("password"); // 3.验证码校验 HttpSession session = request.getSession(); String checkcode_server = (String) session.getAttribute("CHECKCODE_SERVER"); session.removeAttribute("CHECKCODE_SERVER");// 确保验证码一次性 System.out.println("checkcode_server-"+checkcode_server+"username"+username+"password"+password+"verifycode"+verifycode); if (!checkcode_server.equalsIgnoreCase(verifycode)) { // 验证码不正确 // 提示信息 request.setAttribute("login_msg", "验证码错误!"); // 跳转登录页面 request.getRequestDispatcher("/Manager/login.jsp").forward(request, response); return; } // 4.封装User对象 User200 user = new User200(); user.setUsername200(username); user.setPassword200(password); // 5.调用Service查询 IUserService200 ius200 = new UserServiceImpl200(); User200 loginUser = ius200.findUserByUsernameAndPassword(username, password); // 6.判断是否登录成功 if (loginUser != null) { // 登录成功 // 将用户存入session session.setAttribute("user", loginUser); // 跳转页面 if(1==loginUser.getId200()){ response.sendRedirect(request.getContextPath() + "/Manager/main.jsp");//管理后台主界面 }else{ response.sendRedirect(request.getContextPath() + "/message.jsp");//管理后台主界面 } } else { // 登录失败 // 提示信息 request.setAttribute("login_msg", "用户名或密码错误!"); // 跳转登录页面 request.getRequestDispatcher("/Manager/login.jsp").forward(request, response); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } ``` ### 6.菜单控制器类 ``` package com.baishenghua200.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 com.baishenghua200.pojo.Menu200; import com.baishenghua200.services.IMenuService200; import com.baishenghua200.services.impl.MenuServiceImpl200; /** * MenuServlet200.java(导航菜单控制器类) * @desc 主要控制导航菜单模型数据和视图展示 * @author 柏圣华 * @date 2021-10-21 * */ @WebServlet("/MenuServlet200") public class MenuServlet200 extends HttpServlet { private static final long serialVersionUID = 1L; IMenuService200 ims200 = new MenuServiceImpl200(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String method = request.getParameter("method"); //method的取值有editMenu、deleteMenu、addMenu、updateMenu、queryAllMenu Menu200 menu200 = new Menu200(); System.out.println("当前操作:"+method+" MenuServlet200"+"——执行"); if("addMenu".equalsIgnoreCase(method)) {//添加导航菜单信息操作 String menuNo200 = request.getParameter("menuNo200");//获取AddMenu.jsp界面菜单序号的输入框的值 String menuName200 = request.getParameter("menuName200");//获取AddMenu.jsp界面菜单名称的输入框的值 String menuURL200 = request.getParameter("menuURL200");//获取AddMenu.jsp界面菜单地址的输入框的值 menu200.setMenuNo200(menuNo200);//给menu200的属性MenuNo200设置值(menuNo200变量保存的值) menu200.setMenuName200(menuName200);//给menu200的属性MenuName200设置值(menuName200变量保存的值) menu200.setMenuURL200(menuURL200);//给menu200的属性MenuURL200设置值(menuURL200变量保存的值) System.out.println("当前操作:"+method+" MenuServlet200"+"if分支addMenu"+menu200+"——执行"); //调用服务层接口实现类的添加方法,把AddMenu.jsp界面获取的数据添加到数据库表中 int flag = ims200.add200(menu200); System.out.println("当前操作:"+method+" MenuServlet200"+"if分支addMenu"+menu200+"——执行ims200.add200()之后"+flag); //添加完成数据之后,直接跳转到查询所有的界面,数据量少可以之跳转,数据量多就要分页 queryAll(request,response); }else if("editMenu".equalsIgnoreCase(method)) {//编辑导航菜单信息操作 String id200 = request.getParameter("id200");//获取main.jsp界面菜单编号的值 System.out.println("当前操作:"+method+" MenuServlet200"+"if分支editMenu"+id200+"——执行"); //Integer.parseInt(id200)使用Integer类的parseInt()方法,把id200字符串形式的值,转化为int类型 menu200.setId200(Integer.parseInt(id200)); menu200 = ims200.query200(menu200);//根据点击main.jsp页面的编辑获取菜单的编号,去数据库表中查询这个菜单信息 System.out.println("当前操作:"+method+" MenuServlet200"+"if分支editMenu"+menu200+"——执行ims200.query200()之后"); request.setAttribute("menu", menu200);//把数据库表中的menu信息放到request的menu属性里面 request.getRequestDispatcher("MenuManager/EditMenu200.jsp").forward(request, response);// 转发到EditMenu.jsp页面上去 }else if("deleteMenu".equalsIgnoreCase(method)) {//删除导航菜单信息操作 String id200 = request.getParameter("id200");//获取main.jsp界面菜单编号的值 System.out.println("当前操作:"+method+" MenuServlet200"+"if分支deleteMenu"+id200+"——执行"); menu200.setId200(Integer.parseInt(id200)); int flag = ims200.delete200(menu200);//调用服务层接口实现类的删除方法,删除菜单menu200 System.out.println("当前操作:"+method+" MenuServlet200"+"if分支deleteMenu"+menu200+"——执行ims200.delete200()之后"+flag); queryAll(request,response); }else if("updateMenu".equalsIgnoreCase(method)) {//编辑导航菜单信息操作 String id200 = request.getParameter("id200");//获取EditMenu.jsp界面菜单编号的值 System.out.println("当前操作:"+method+" MenuServlet200"+"if分支updateMenu"+id200+"——执行"); menu200.setId200(Integer.parseInt(id200)); String menuNo200 = request.getParameter("menuNo200");//获取EditMenu.jsp界面菜单序号的输入框的值 String menuName200 = request.getParameter("menuName200");//获取EditMenu.jsp界面菜单名称的输入框的值 String menuURL200 = request.getParameter("menuURL200");//获取EditMenu.jsp界面菜单地址的输入框的值 menu200.setMenuNo200(menuNo200);//给menu200的属性MenuNo200设置值(menuNo200变量保存的值) menu200.setMenuName200(menuName200);//给menu200的属性MenuName200设置值(menuName200变量保存的值) menu200.setMenuURL200(menuURL200);//给menu200的属性MenuURL200设置值(menuURL200变量保存的值) System.out.println("当前操作:"+method+" MenuServlet200"+"if分支updateMenu"+menu200+"——执行"); int flag = ims200.update200(menu200);//调用服务层接口实现类的更新方法,更新菜单menu200 System.out.println("当前操作:"+method+" MenuServlet200"+"if分支deleteMenu"+menu200+"——执行ims200.updateMenu()之后"+flag); queryAll(request,response); }else if("queryAllMenu".equalsIgnoreCase(method)) {//查询所有导航菜单信息操作 queryAll(request,response); }else if("addPage".equalsIgnoreCase(method)) { request.getRequestDispatcher("/MenuManager/AddMenu200.jsp").forward(request, response); }else {//查询所有导航菜单信息操作 queryAll(request,response); } } /** * 查询所有导航菜单信息的方法 * @param request 请求 * @param response 响应 * @throws ServletException Servlet异常 * @throws IOException IO异常 */ protected void queryAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<Menu200> menusList = ims200.queryAll200();// 调用服务层接口实现类的查询所有方法 request.setAttribute("menus", menusList);// 把查询出来的导航菜单数据集合放到request里面 request.getRequestDispatcher("MenuManager/MainMenu200.jsp").forward(request, response);// 转发到main.jsp页面上去 } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } ```