Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Tell me the example of username validation in apache-wicket?

Answer Posted / Santosh Saraswat

In Apache Wicket, you can create a custom FormValidator for username validation. Here's an example using Regular Expression (regex) to validate usernames:nn```javanpublic class UsernameValidator extends FormValidator<String> {n private static final String REGEX = "^[a-zA-Z0-9_-]{3,20}$";n public UsernameValidator() {n super(REGEX);n }n}n```nIn the form's add() method, you can register the validator for the username field:n```javanForm form = new Form("login") {n @Overriden protected void onSubmit() {n // Handle form submission heren }n};nTextField<String> usernameField = new TextField<String>("username", this);nusernameField.add(new UsernameValidator());nform.add(usernameField);n```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category