首页 > 移动平台 > 详细

android 学习

时间:2021-06-20 23:03:49      阅读:25      评论:0      收藏:0      [点我收藏+]

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);
}
}

 

android 学习

原文:https://www.cnblogs.com/Nojava/p/14908281.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!