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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:57:34+00:00 2026-06-17T10:57:34+00:00

Having big problems with Hibernate Validator Getting this error java.lang.IllegalStateException: Neither BindingResult nor plain

  • 0

Having big problems with Hibernate Validator

Getting this error

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘company’ available as request attribute

Here is my Controller

 import java.util.logging.Logger;

 import javax.validation.Valid;

 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.SessionAttributes;

 import com.muuves.reservosity.model.Business_Register;

 @Controller
 @SessionAttributes( {"company"})
 @RequestMapping("/business")
 public class BusinessController {
private final static Logger LOG = Logger.getLogger(BusinessController.class .getName()); 


@RequestMapping(method = RequestMethod.GET)
public String business(ModelMap model) {
    LOG.info("Entering Business Home");
    model.put("company", new Business_Register());
    return "business";
}
@RequestMapping(value="/register", method = RequestMethod.GET)
public String businessRegister() {
    LOG.info("Register Business Page");
    return "business_register";
}

@RequestMapping(value = "/add", method = RequestMethod.POST)
public String addBusiness(@Valid Business_Register company, BindingResult result, ModelMap model) {
    LOG.info("Registering Business"+result.getErrorCount());
    if (result.hasErrors()){
        System.out.println("I found errors now now");
        return "business_register";
    }
    //companyService.addCompany(company);
    return "business_add";
}

}

This is jsp

 <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

 <div class="row main-content-reservosity">
<div class="twelve columns">
    <h3>Register Your Business</h3>
    <p>Please register your business details below</p>
    <form:form method="post" action="add" commandName="company">
        <form:errors path="Company"></form:errors>
        <form:input type="text" placeholder="Company Name" path="Company"/>
        <div class="row">
            <div class="six columns">
                <form:input type="text" placeholder="Address Line 1" path="Address_Line_1"/>
                <form:errors path="Address_Line_1"></form:errors>
            </div>
            <div class="six columns">
                <form:input type="text" placeholder="Address Line 2" path="Address_Line_2"/>
                <form:errors path="Address_Line_2"></form:errors>
            </div>
        </div>
        <div class="row">
            <div class="four columns">
                <form:input type="text" placeholder="Postcode" path="Postcode"/>
                <form:errors path="Postcode"></form:errors>
            </div>
            <div class="four columns">
                <form:input type="text" placeholder="County" path="County"/>
                <form:errors path="County"></form:errors>
            </div>
            <div class="four columns">
                <form:input type="text" placeholder="Country" path="Country"/>
                <form:errors path="Country"></form:errors>
            </div>
        </div>
        <div class="row">
            <div class="six columns">
                <form:input type="text" placeholder="Mobile telephone" path="Mobile_Number"/>
                <form:errors path="Mobile_Number"></form:errors>
            </div>
            <div class="six columns">
                <form:input type="text" placeholder="Home telephone" path="Telephone_Number"/>
                <form:errors path="Telephone_Number"></form:errors>
            </div>
        </div>
        <form:errors path="Username"></form:errors>
        <form:input type="text" placeholder="Username" path="Username"/>
        <form:errors path="Password"></form:errors>
        <form:input type="password" placeholder="Password" path="Password"/>
        <br/>
        <button class="radius button" type="submit">Register</button>
        <button class="radius button" type="reset">Cancel</button>
    </form:form>
</div>
  </div>

   import org.hibernate.validator.constraints.NotBlank;

   public class Business_Register {

@NotBlank(message="Name field is mandatory.")
private String Company;
@NotBlank(message="Name field is mandatory.")
private String Address_Line_1;
@NotBlank(message="Name field is mandatory.")
private String Address_Line_2;
@NotBlank(message="Name field is mandatory.")
private String Postcode;
@NotBlank(message="Name field is mandatory.")
private String County;
@NotBlank(message="Name field is mandatory.")
private String Country;
@NotBlank(message="Name field is mandatory.")
private String Mobile_Number;
@NotBlank(message="Name field is mandatory.")
private String Telephone_Number;
@NotBlank(message="Name field is mandatory.")
private String Username;
@NotBlank(message="Name field is mandatory.")
private String Password;

public String getCompany() {
    return Company;
}
public void setCompany(String company) {
    Company = company;
}
public String getAddress_Line_1() {
    return Address_Line_1;
}
public void setAddress_Line_1(String address_Line_1) {
    Address_Line_1 = address_Line_1;
}
public String getAddress_Line_2() {
    return Address_Line_2;
}
public void setAddress_Line_2(String address_Line_2) {
    Address_Line_2 = address_Line_2;
}
public String getPostcode() {
    return Postcode;
}
public void setPostcode(String postcode) {
    Postcode = postcode;
}
public String getCounty() {
    return County;
}
public void setCounty(String county) {
    County = county;
}
public String getCountry() {
    return Country;
}
public void setCountry(String country) {
    Country = country;
}
public String getMobile_Number() {
    return Mobile_Number;
}
public void setMobile_Number(String mobile_Number) {
    Mobile_Number = mobile_Number;
}
public String getTelephone_Number() {
    return Telephone_Number;
}
public void setTelephone_Number(String telephone_Number) {
    Telephone_Number = telephone_Number;
}
public String getUsername() {
    return Username;
}
public void setUsername(String username) {
    Username = username;
}
public String getPassword() {
    return Password;
}
public void setPassword(String password) {
    Password = password;
}
  }

I have import this into my pom.xml

            <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.3.1.Final</version>
    </dependency>
  • 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-17T10:57:36+00:00Added an answer on June 17, 2026 at 10:57 am

    Needed to add @ModelAttribute(“company”) http://blog.nigelsim.org/2011/09/07/spring-mvc-validation-bindingresult/

    And it works

    Seems ridiculous that you needed to do this though

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

Sidebar

Related Questions

Having big problems trying to get my php script to send email. Using this
I am having big problems compiling java servlets. As far as I can see,
Here is a (big) example of the massive problem I am having, when this
In MVC app, I am having this big object that is used in classic
I'm having a very big struct in an existing program. This struct includes a
I'm having big problems with a code that should add watermark pictures (used as
I am having problems getting the GTK designer to work with MonoDevelop. I tried
I’m from a .NET background and now dabbling in Java. Currently, I’m having big
I'm having problems with Ruby scripts finding the right gems. It seems this is
I am having this big database on one MSSQL server that contains data indexed

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.