• android 学习


    servlet层

    package servlet;
    import java.util.List;
    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 Dao.Dao;
    
    import Bean.Diqu;
    import Bean.Sheng;
    
    
    @WebServlet("/Servlet")
    public class Servlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
           
        
        public Servlet() {
            super();
            
        }
        protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            req.setCharacterEncoding("utf-8");
            String method = req.getParameter("method");
            if ("tcha".equals(method)) {
                tcha(req,resp);
            }
        }   
        private void tcha(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
            String []m=new String[34];
            req.setCharacterEncoding("utf-8");
            Dao dao =new Dao();
            HttpSession session = req.getSession();
            String time = (req.getParameter("time"));
            String locate= (req.getParameter("locate"));
            List<Diqu> holds = dao.tcha(time,locate);
            List<Sheng> holds1 = dao.Scha(time);
            for(int i = 0; i < holds1.size(); i++){
                Sheng d=holds1.get(i);
                m[i]=d.getPerson();
            }
            System.out.println(m[0]);
            req.setAttribute("m", m);
            req.setAttribute("holds", holds);
            req.getRequestDispatcher("index.jsp").forward(req,resp);
    }
    }
  • 相关阅读:
    四种PHP异步执行的常用方式
    PHP 多进程和多线程的优缺点
    试着用workerman开发一个在线聊天应用
    Python代码报错看不懂?记住这20个报错提示单词轻松解决bug
    PHP面试题大全(值得收藏)
    常见排序算法(三)
    常见排序算法(二)
    常见排序算法(一)
    NumPy 学习笔记(四)
    JavaScript 事件
  • 原文地址:https://www.cnblogs.com/Nojava/p/14908281.html
Copyright © 2020-2023  润新知