publicclassticketsvltextendsHttpServlet{booleanflag;publicvoiddoGet(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException{req.setCharacterEncodi...
public class ticketsvlt extends HttpServlet { boolean flag; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); String ticketid = req.getParameter("ticketid"); System.out.println(ticketid); String userid = req.getParameter("userid"); System.out.println(userid); int success = 0; String action = req.getParameter("action"); System.out.println(action); ticket t = null;
if ("order".equalsIgnoreCase(action)) { flag = true; t = doOrder(req, res); System.out.print("ok"); if (flag) sendBean(req, res, t, "/ticketinfo.jsp"); } if ("delete".equalsIgnoreCase(action)) { .......... } }
public void sendBean(HttpServletRequest req, HttpServletResponse res, ticket tt, String target) throws ServletException, IOException { req.setAttribute("ticket", tt); RequestDispatcher rd = req.getRequestDispatcher(target); rd.forward(req, res); }
反复检查确认web.xml的过滤路径都是正确的
doPost()调用doGet()里的方法
已用输出语句检验过各值均传到此JSP页面了,但点表单提交后,浏览器URL转入ticketsvlt,但不跳到ticketinfo页面,myeclipse的console也没有报错.delete方法可以调用,但delete方法里不涉及页面跳转
表单截图如下:
展开