每日双人总结

多功能实现查找

多功能实现查找

package com.jy.web;

import com.jy.pojo.TotalStation;
import com.jy.service.Service;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet("/ResearchServlet")
public class ResearchServlet extends HttpServlet {
    private Service service=new Service();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        String Method=request.getParameter("Method");
        if(Method.equals("XLCX"))
        {
            String routine=request.getParameter("routine");
            List <TotalStation> totalStations1=service.research1(routine);
            request.setAttribute("totalStations1", totalStations1);
            request.getRequestDispatcher("index.jsp").forward(request, response);
        }
        else if(Method.equals("ZDCX"))
        {
            String station=request.getParameter("station");
            List <TotalStation> totalStations2=service.research2(station);
            System.out.println(totalStations2);
            request.setAttribute("totalStations2", totalStations2);
            request.getRequestDispatcher("index.jsp").forward(request, response);
        }
        else if(Method.equals("SECX"))
        {
            String station1=request.getParameter("station1");
            String station2=request.getParameter("station2");
            service.research3(station1,station2);
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}

 

posted @ 2023-03-15 22:33  cojames  阅读(9)  评论(0编辑  收藏  举报