地铁路线查询
@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() {
}
}