
Hello sir, i am developing a login page. i want that when i fill data in text fields. it validate data from database. if enter data is match from database. page goes to next page which is servlet. otherwise display an error message.

Hi Sahil
The problem you shared with us is already have solution. Go through the code below :
http://www.roseindia.net/tutorial/jquery/jquerycheckusername.html
The code below used jQuery post method which check the username availability without changing the page.

import java.util.regex.Matcher; import java.util.regex.Pattern;
public class UsernameValidator{
private Pattern pattern;
private Matcher matcher;
private static final String USERNAME_PATTERN = "^[a-z0-9_-]{3,15}$";
public UsernameValidator(){
pattern = Pattern.compile(USERNAME_PATTERN);
}
public boolean validate(final String username){
matcher = pattern.matcher(username);
return matcher.matches();
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.