添加文本 java requestDispatcher
Add text java requestDispatcher
我想在 url
中使用相同的方法将用户引导回上一页
if (somecheck) {
req.getRequestDispatcher("register.jsp?email="+req.getParameter("email")).forward(req, resp);
}
但这会将用户定向到 "/register.jsp"
而不是 "/register.jsp?email=testemail@mail.com"
如何将电子邮件添加到 url?
ServletContext context = request.getServletContext();
String path = "/register.jsp?email="+request.getParameter("email");
RequestDispatcher rd = context.getRequestDispatcher(path);
rd.include(request, response);
解决方案正在使用 response.sendRedirect("register.jsp?email="+req.getParameter("email"));
感谢 Anton Dovzhenko
我想在 url
中使用相同的方法将用户引导回上一页if (somecheck) {
req.getRequestDispatcher("register.jsp?email="+req.getParameter("email")).forward(req, resp);
}
但这会将用户定向到 "/register.jsp"
而不是 "/register.jsp?email=testemail@mail.com"
如何将电子邮件添加到 url?
ServletContext context = request.getServletContext();
String path = "/register.jsp?email="+request.getParameter("email");
RequestDispatcher rd = context.getRequestDispatcher(path);
rd.include(request, response);
解决方案正在使用 response.sendRedirect("register.jsp?email="+req.getParameter("email"));
感谢 Anton Dovzhenko