Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7741189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:57:43+00:00 2026-06-01T08:57:43+00:00

I validate in two ways – using spring validator for custom validation and javax.validation

  • 0

I validate in two ways – using spring validator for custom validation and javax.validation for quick and general

Spring does things neatly, where this code will go exactly to document with given locale and extract text required.

 private Errors checkPasswordMatch(Person p, Errors errors) {
   if (!p.getPassword().equals(p.getRepeatedPassword())) {
   errors.rejectValue("password", "person.password.mismatch");
   errors.rejectValue("repeatedPassword", "person.password.mismatch");
    }
    return errors;
}

Javax is less hassle, but there is no way to produce message in different languages.

    @NotNull
    @Size(min = 10, max = 10, message = "size must be 10 characters")
    protected String birthDate;

How to advise javax to go to some GB.properties or US.properties or IT.properties file to extract messages same way spring does depending on user locale?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:57:44+00:00Added an answer on June 1, 2026 at 8:57 am
    @Size(min = 10, max = 10, message = "{birthDate.size}")
    protected String birthDate;
    

    in (create one in classpath if you dont have one) ValidationMessages.properties define as birthDate.size = some message

    EDIT 1:

    Keep files seperate. ValidationMessages needs to be shipped/packaged along with your beans all the time unlike your app specific messages. You dont need to define a bean for ValidationMessages.properties file. It will be picked up automatically

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery Validation plugin and trying to validate two time fields. I
how i do validate two date textboxes using jquery. i came across this snippet
can I validate two interdependent fields in with one validator? <h:form> <h:inputText value=#{logRegBean.person.name} >
I have two logical groups of input fields I need to validate separately using
I am using jQuery validate to validate a form. I have two text boxes
I'm using this two plug-ins jquery.validate and jquery.form separately, but I would like to
Using Symfony1, how could I validate one of two fields is being filled in
I need to validate two user input fields against each other in seam. Field1
I am trying to validate two fields. One is open time and the other
I have the following code to validate two text box entries to make sure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.