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 8116447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:50:27+00:00 2026-06-06T03:50:27+00:00

validation-api-1.0.0.GA.jar and hibernate-validator-4.1.0.Final.jar are in classpath. mvc:annotation-driven is in -servlet.xml file. @RequestMapping(value = /addEmployee,

  • 0
validation-api-1.0.0.GA.jar and hibernate-validator-4.1.0.Final.jar are in classpath. 


mvc:annotation-driven is in -servlet.xml file.


@RequestMapping(value = "/addEmployee", method = RequestMethod.POST)
public ModelAndView addEmployee(@Valid EmployeeDTO employeeDTO,
BindingResult result)
{

   System.out.println("addEmployee employeeDTO! "+ employeeDTO);
       System.out.println("result.getErrorCount()  "+result.getErrorCount());

}


public class EmployeeDTO {

private int employeeId;
public int getEmployeeId() {
    return employeeId;
}


public void setEmployeeId(int employeeId) {
    this.employeeId = employeeId;
}

@NotNull
private String firstName;
@NotNull 
private String lastName;
private Date hireDate;

}

 in the console

 addEmployee employeeDTO! EmployeeDTO [employeeId=0, firstName=, lastName=, deptName=null, deptId=0, email=, salary=0, jobId=AD_VP, hireDate=null]
result.getErrorCount()  0
  • 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-06T03:50:33+00:00Added an answer on June 6, 2026 at 3:50 am

    The DTO doesn’t seem to be invalid, according to the console message that you quoted. The firstName and lastName fields seem to be set as empty strings "", not null; therefore, there’s no reason for the validation to reject your bean.

    If you want empty input fields to be bound as null (and rejected by validation), you can register a StringTrimmerEditor in your binder.

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

Sidebar

Related Questions

My deps file: - org.hibernate -> hibernate-core 3.6.8.Final: force: true exclude: - ant ->
Does JPA contains any validation API? E.g. email property validation like this in hibernate
I'm trying to integrate bean validation using hibernate validator to my web application :
am having a problem configuring tomcat with richfaces. I copied the: richfaces-components-ui-4.2.2.Final.jar richfaces-components-api-4.2.2.Final.jar richfaces-core-api-4.2.2.Final.jar
validation of HMAC generated hash requires the key to be known to the validator.
For data validation, for example during migrations from one XML library to a new
I do some form validation to ensure that the file a user uploaded is
I have a fluent validation API that throws an exception when a supplied boolean
I would like to use Gwt-Validation with Gwt 2.4.0. I have in my gwt.xml
I have problem with using Hibernate Validator with GWT 2.4. When module is starting

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.