Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Spring MVC check username in db before submission

I am making a web application using Spring MVC and jsp. I am quite new to this and really struggling to find an approach to validating a username from DB before submitting the form. Here is a demo of the kind of thing am looking for http://www.bitrepository.com/demo/username-checker/

Would appreciate any help given. Thank you

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You can find a lot of answers if you search "Spring MVC form validation" on Google. For example, spring official tutorial: https://spring.io/guides/gs/validating-form-input/

Another example on codejava.net: http://www.codejava.net/frameworks/spring/spring-mvc-form-validation-example-with-bean-validation-api

about 4 years ago · Santiago Trujillo Report

0

Followed this this tutorial:

http://www.mkyong.com/spring-mvc/spring-4-mvc-ajax-hello-world-example/

Thank you very much @YohanesGultom

about 4 years ago · Santiago Trujillo Report

0

you can check username by jquery validation

$("#myform").validate({
  rules: {
    email: {
      required: true,
       remote: {
            url: 'checkUserName',
            data: { userName: $('#username').val()},
            dataFilter: function(data) {
                var json = JSON.parse(data);
                console.log(data);
            }
    }
  },
  messages: {
    email: {
      required: "This field is required",
      remote: "Email address already in use. Please use other email."
    }
  }
});

and in your controller add this method :

@requestMapping("checkUserName")
@responseBody
public boolean  checkUser(@requestParam("userName") String userName){

 return // method return bolean if user exist or non in database.
}
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!