zoukankan      html  css  js  c++  java
  • 2021/4/7

    1.今日收获内容
    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 java.text.SimpleDateFormat;
    import java.util.Date;
    
    import Bean.*;
    
    import Dao.Dao;
    
    
    @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 ("zzt".equals(method)) {
    			zzt(req, resp);
    		}
    		
    	}   
        
        
     
    	private void zzt(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{
    		req.setCharacterEncoding("utf-8");
    		
    		Dao dao =new Dao();
    		String time = (req.getParameter("time"));
    		String locate= (req.getParameter("locate"));
    		
    		System.out.println(locate);
    		
    		
    		SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间 
            sdf.applyPattern("yyyy-MM-dd");// a为am/pm的标记  
            Date date = new Date();// 获取当前时间 
            System.out.println(date.toString());
            
    		
    		List<Diqu> holds = dao.cha(time,locate);
    		List<Diqu2> holds2 = dao.cha2(time,locate);
    		List<china> holds3 = dao.cha3("2021-03-29");
    		String []m=new String[34];
    		String []n=new String[34];
    		String j="";
    		String k="";
    		
    		for(int i=0;i<holds3.size();i++)
    		{
    			china f=holds3.get(i);
    			j=f.getQue();
    			k=f.getNewque();
    			
    		}
    		System.out.println(j);
    		for(int i=0;i<holds.size();i++)
    		{
    			Diqu d=holds.get(i);
    			m[i]=d.getPerson();
    			n[i]=d.getDiqu();
    		}
    		HttpSession session = req.getSession();
    		req.setAttribute("k",k);
    		req.setAttribute("j",j);
    		req.setAttribute("m",m);
    		req.setAttribute("mm",n);
    		
    		req.setAttribute("holds", holds);
    		req.setAttribute("holds2", holds2);
    		req.setAttribute("holds3", holds3);
    		System.out.println("d"+holds);
    		req.getRequestDispatcher("index.jsp").forward(req,resp);
    }
    }
    

     
    2.遇到的问题
    sesion传输数据不成功

    3.明天目标

    java

  • 相关阅读:
    GOLANG之学习类库-mysql
    GOLANG学习之类库-goconfig
    PHP进程实现方式之死循环(一)
    PHPexcel之读取表格(三)
    PHPExcel之生成表格汇总列(二)
    GOLAND常用基本命令介绍
    PHPExcel之生成xlsx并下载(一)
    nginx之版本升级方法一
    php linux yaml 的安装和使用
    【Go语言学习笔记】Go的defer
  • 原文地址:https://www.cnblogs.com/qiangini/p/14907946.html
Copyright © 2011-2022 走看看