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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:13:18+00:00 2026-06-11T05:13:18+00:00

When using custom validation under this scenario: if(officer.getBadgeId() == 0){ errors.rejectValue(badgeId, badgeId.required); } if

  • 0

When using custom validation under this scenario:

if(officer.getBadgeId() == 0){

        errors.rejectValue("badgeId", "badgeId.required");
}

if the POJO/Model officer has a datatype of int for the badgeId can a string be set as the error message for the attribute? Or the datatype of the attribute does not matter when doing validation and returning error messages to the view.

If it is an issue how do you handle this scenario in terms or returning an error message to the user from custom validation

  • 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-11T05:13:20+00:00Added an answer on June 11, 2026 at 5:13 am

    Error message will be of type String only.

    void rejectValue(String field, String errorCode, String
    defaultMessage)
    Reject the given field of the current object, using the given error description.

    Spring doc link.

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

Sidebar

Related Questions

Is this the only way to create custom model validation? To do it using
I had been created text box custom validation control and I'm using this in
I am using CodeIgniter's form validation . Here is an example: $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
Im carrying out some form validation with codeigniter using a custom validation callback. $this->form_validation->set_rules('testPost',
simple custom validation, my model and custom validation: public class Registration { [Required(ErrorMessage =
I have custom validation in my model very similar to this one: Multifield/range validation
I validate in two ways - using spring validator for custom validation and javax.validation
I am using jquery validation plugin for form validation. I have added a custom
I've created a custom textInput componenet that handles it's own validation using a private
HI Folks, I'm using the Struts 2 validation. And for displaying the custom error

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.