我确实使用servlet登记,但它确实有效。
如何验证表格填写? 例如,如果用户名已经注册,请将用户重新发送到.jsp文件?
抱歉英文不好。
答案 0 :(得分:2)
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// fetch the username that was sent in the request
String username = request.getParameter("username");
// TODO: verify if the username is taken in the database
// based on the results set the value
request.setAttribute("isUsernameTaken", "true");
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/register.jsp");
dispatcher.forward(request, response);
}