zoukankan      html  css  js  c++  java
  • 毕业设计-1.16

    情况概述:

      今天复习了可视化的内容,关于echarts以及图表的展示。对servlet的编写。

    代码如下:

    package com.zlc.servlet;
    
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import com.zlc.dao.IWeatherDao;
    import com.zlc.dao.impl.WeatherDaoImpl;
    import com.zlc.entity.WeatherBean;
    import com.zlc.service.IWeatherService;
    import com.zlc.service.impl.WeatherServiceImpl;
    
    /**
     * @author Zhao Lucang
     * @version 创建时间:2021年2月26日 下午10:31:02 类说明
     */
    public class WeatherSearch01 extends HttpServlet {
    
        /**
         * Constructor of the object.
         */
        public WeatherSearch01() {
            super();
        }
    
        /**
         * Destruction of the servlet. <br>
         */
        public void destroy() {
            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
         */
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
            // 定义接收编码
            request.setCharacterEncoding("UTF-8");
            // 定义输出
            response.setContentType("text/html");
            response.setCharacterEncoding("utf-8");
            String City=request.getParameter("City");
            int Date=Integer.parseInt(request.getParameter("Date"));
            IWeatherService service = new WeatherServiceImpl();
            IWeatherDao dao = new WeatherDaoImpl();
            List<WeatherBean> weathers = new ArrayList<WeatherBean>();
            weathers = service.queryAllWeathersByCityDate(City, Date);
            request.setAttribute("weathers", weathers);
            request.getRequestDispatcher("../Demo01.jsp").forward(request, response);
            //response.sendRedirect("../Demo02.jsp");
        }
    
        /**
         * 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
         */
        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
            doGet(request, response);
        }
    
        /**
         * Initialization of the servlet. <br>
         *
         * @throws ServletException if an error occurs
         */
        public void init() throws ServletException {
            // Put your code here
        }
    
    }
  • 相关阅读:
    [GXYCTF2019]BabyUpload
    [GYCTF2020]Blacklist
    [极客大挑战 2019]HardSQL
    PHP实现MVC框架路由功能模式
    色环电阻的阻值识别
    python的内存回收机制
    配置Openfiler做ISCS实验
    windows server 2008r2 在vmware里自动关机
    VMware Workstation网络修改vlan id值
    linux的服务自动启动的配置
  • 原文地址:https://www.cnblogs.com/zlc364624/p/14461049.html
Copyright © 2011-2022 走看看