结对作业第九天

 

@WebServlet("/SubwayLine")
public class SubwayLine extends HttpServlet {

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{

resp.setContentType("text/html;charset=UTF-8");
PrintWriter out = resp.getWriter();

String select = req.getParameter("line");

DB db = new DB();
Sub sub = new Sub();
ArrayList<String> l1 = sub.ArrayStationLine(select);
if (l1!=null){
req.setAttribute("routeLine", l1);
req.getRequestDispatcher("/lineresult.jsp").forward(req, resp);
}else {
req.getRequestDispatcher("/fail.jsp").forward(req, resp);
}

}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
@Override
public void init() throws ServletException {
}
@Override
public void destroy() {

}
}
posted @ 2024-04-22 19:17  欧吼吼  阅读(3)  评论(0编辑  收藏  举报