/** * Constructor of the object. */ publicUserLoginServlet(){ super(); }
/** * Destruction of the servlet. <br> */ publicvoiddestroy(){ super.destroy(); // Just puts "destroy" string in log // Put your code here }
/** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ publicvoiddoGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); }
/** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred
sql = "insert into kecheng(name,jiaoshi,keshi,beizhu) values('"+name+"','"+jiaoshi+"','"+keshi+"','"+beizhu+"')"; int flag = ib.insertANDupdateANDdel(sql); if(flag == -1){ str = "/admin/kecheng.jsp?mark="+mark; request.setAttribute("message", "课程名称重复!"); }else{ request.setAttribute("message", "操作成功!"); } } if(mark != null && mark.equals("update")){ str = "/admin/kecheng_list.jsp"; sql = "update kecheng set name='"+name+"',jiaoshi='"+jiaoshi+"',keshi='"+keshi+"',beizhu='"+beizhu+"' where id="+id; int flag = ib.insertANDupdateANDdel(sql); if(flag == -1){ str = "/admin/kecheng.jsp?mark="+mark+"&id="+id; request.setAttribute("message", "课程名称重复!"); }else{ request.setAttribute("message", "操作成功!"); } } RequestDispatcher rd=request.getRequestDispatcher(str); rd.forward(request,response); }
/** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ publicvoidinit()throws ServletException { // Put your code here }