基本上已经完成了所有的功能。因为已经开始谋划大的团队作业了,所以这个弄的慢了一些
完成这些后,这个项目就算告一段落了
看完善以后的Servlet文件
package classes.com.servlet; 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 classes.com.bean.dao; /** * Servlet implementation class DataServlet */ @WebServlet("/DataServlet") public class DataServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public DataServlet() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType("text/text;charset=UTF-8"); String method = request.getParameter("method"); System.out.println("DataServlet"); if(method.equals("c1")) { try { System.out.println("c1"); dao dao = new dao(); String get_c1_data = dao.get_c1_data(); response.getWriter().write(get_c1_data); } catch (Exception e) { e.printStackTrace(); } }else if(method.equals("c2")) { try { dao dao = new dao(); String get_c2_data = dao.get_c2_data(); response.getWriter().write(get_c2_data); } catch (Exception e) { e.printStackTrace(); } }else if(method.equals("c3")) { try { dao dao = new dao(); String get_c3_data = dao.get_c3_data(); response.getWriter().write(get_c3_data); } catch (Exception e) { e.printStackTrace(); } }else if(method.equals("l1")) { try { dao dao = new dao(); String get_l1_data = dao.get_l1_data(); response.getWriter().write(get_l1_data); } catch (Exception e) { e.printStackTrace(); } }else if(method.equals("l2")) { try { dao dao = new dao(); String get_l2_data = dao.get_l2_data(); response.getWriter().write(get_l2_data); } catch (Exception e) { e.printStackTrace(); } }else if(method.equals("r1")) { try { dao dao = new dao(); String get_r1_data = dao.get_r1_data(); response.getWriter().write(get_r1_data); } catch (Exception e) { e.printStackTrace(); } }else if(method.equals("r2")) { try { dao dao = new dao(); String get_r2_data = dao.get_r2_data(); response.getWriter().write(get_r2_data); } catch (Exception e) { e.printStackTrace(); } } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }