We have startded coding a new jsf web application. We have a login page that has a userid and password field. We have a PageValidationController class that we are going to use for page validation for our application to validate userid/password/emails, etc. Could someone help me write the code to validate the userid and password the user enters? This is just page validation, so we want to validate things like, the user id cannot start with _*+/, etc, Must be at least 6 characters long. The same with the password. I am new to java.
You could pick all this stuff up from a basic Java tutorial.
Code:
String strUser = // where ever you get your username from.
String strIllegal = "_, /, *, +, -, %, @, $";
if (strIllegal.indexOf(strUser.substring(0, 1)) > -1)
// Starts with an illegal character.
/**
* @author PRGJXY
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public abstract class PageDataValidator implements Validator {
Bookmarks