/** * 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 { this.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 */ publicvoiddoPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //设置传输数据编码方式 request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html"); HttpSession session=request.getSession(); //获取当前登录用户信息 Object utype=session.getAttribute("utype"); Object userid=session.getAttribute("userid"); //创建json对象 JSONObject json=new JSONObject(); if(utype==null||userid==null){ json.put("msg", "请重新登陆。"); return; }
/** * Constructor of the object. */ publicLoginSvlt(){ 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 { this.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 */ publicvoiddoPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html");
sql="select zhandian.*,xh from zhandian,xianlu where zhandian.id=xianlu.zdid and xianlu.tid="+ids+" order by xh"; hp.setValue("sql", sql); }else{ sql=hp.readValue("sql"); } ResultSet rs=db.query(sql); List<Zhandian> zlist=FindService.getZhandians(rs); request.setAttribute("alist", zlist); DbConn db2=new DbConn(); ResultSet rs2=db2.query("select * from zhandian where id not in(select zdid from xianlu where tid="+ids+")"); List<Zhandian> zdlist=FindService.getZhandian(rs2); request.setAttribute("zdlist", zdlist); DbConn db3=new DbConn(); Object tn=db3.getOnlyOne("select tname from traininfo where id="+ids); Traininfo t=new Traininfo(); t.setId(Integer.parseInt(ids)); t.setTname(tn+""); request.setAttribute("t", t); request.getRequestDispatcher("/admin/mgxianlu.jsp").forward(request, response); return; } //车票信息管理初始化 if("piao".equals(tname)){ String ids=request.getParameter("tid"); if("1".equals(flgs)){ sql="select tmp.*,zdname as eaddr,tname,traintype from (select piao.*,zdname as saddr from piao,zhandian where piao.szdid=zhandian.id and yxsj='1975-01-01' and zdname like '%0%') tmp,zhandian,traininfo where tmp.tid=traininfo.id and tmp.ezdid=zhandian.id and zdname like '%0%' and 1=0"; hp.setValue("sql", sql); }else{ sql=hp.readValue("sql"); } ResultSet rs2=db.query(sql); List<Piao> plist=FindService.getPiao(rs2); request.setAttribute("alist", plist); DbConn db2=new DbConn(); ResultSet rs=db2.query("select * from traininfo"); List<Traininfo> tlist=FindService.getTraininfo(rs); request.setAttribute("tlist", tlist); request.getRequestDispatcher("/admin/mgpiao.jsp").forward(request, response); return; }
/** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ publicvoidinit()throws ServletException { // Put your code here }
} package dp.svlt;
publicclassDpListSvltextendsHttpServlet{
/** * Constructor of the object. */ publicDpListSvlt(){