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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:19:43+00:00 2026-05-16T17:19:43+00:00

I have a form that looks like this public class ValidationForm { private Person

  • 0

I have a form that looks like this

public class ValidationForm {
  private Person person;
  @Size(min=1,max=10,message="out of range")
  private String test;
  //other stuff

My validation controller is like this

public void processForm(@Valid @ModelAttribute("validateForm") ValidationForm vform, 
  BindingResult result){

My Person class is like this

public class Person {
private String id;
@Size(min=1, max=35, message="Enter less than 35 Charercters")
private String firstName;
@Size(min=1, max=35, message="Enter less than 35 Charercters")
private String lastName;

if firstname or lastname is empty in my jsp page, there is no validation error. but if test is empty then there is a validation error. What should i do to validate properties of object in the form. Right now only properties of the form are getting validated.

  • 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-05-16T17:19:43+00:00Added an answer on May 16, 2026 at 5:19 pm

    I changed my validation form to

    public class ValidationForm {
    @Valid
    private Person person;
    @Size(min=1,max=10,message="out of range")
    private String test;
    

    and now it works

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

Sidebar

Related Questions

I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
I have a form that looks like this: class SampleForm(forms.Form): text = forms.CharField(max_length=100) In
I have a data structure that looks like this: public class Node { public
I have a model that looks like this: public class Book { public string
I have model that looks like this: public class Lesson { public int Id
Ok, I have a ViewModel that looks like this: public class UserLogin { [Required]
Well i have a complex form view model like this : public class TransactionFormViewModel
Let's say that you have a Model that looks kind of like this: public
I'm perplexed by this. I have a login action that looks like this: public
Hi, I have a action that looks like this : [AcceptVerbs(HttpVerbs.Post)] public ActionResult Register(AdRegister

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.