servlets - Form filling validation in Java -
i check in servlet, works.
how validation of form filling? example, re-send user .jsp-file, if username registered?
sorry bad english.
public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // fetch username sent in request string username = request.getparameter("username"); // todo: verify if username taken in database // based on results set value request.setattribute("isusernametaken", "true"); requestdispatcher dispatcher = getservletcontext().getrequestdispatcher("/register.jsp"); dispatcher.forward(request, response); }
Comments
Post a Comment