• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

[java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'User'

Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to spring , i am trying an example in spring MVC, but i am getting the mentioned error ,please check my code and help me to resolve the issue.
I tried in different URL mappings (like beanNameUrlMapping ,simpleUrlMapping ) but unable to resolve the issue, please let me know root cause for this issue and steps to resolve the issue

Thanks in Advance
My code
In this example i am just entering registration details in a jSP and want to show the details in once user details once registration is done.


<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<title>Spring 3 MVC Series - Contact Manager</title>
<form:form method="post" action="addContact.html" commandName="User" >

<td><form:label path="firstname">First Name</form:label></td>
<td><form:input path="firstname" /></td>
<td><form:label path="lastname">Last Name</form:label></td>
<td><form:input path="lastname" /></td>
<td><form:label path="email">Email</form:label></td>
<td><form:input path="email" /></td>
<td><form:label path="telephone">Telephone</form:label></td>
<td><form:input path="telephone" /></td>
<td colspan="2">
<input type="submit" value="Add Contact"/>


config.xml file

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"

<context:component-scan base-package="com.mys" />

<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />

<bean id="userService" class="com.mys.services.UserServiceImpl" />

<bean name="/addContact.html" class="com.mys.login.RegistrationController"
p:userService-ref="userService" p:formView="Register" p:successView="success" />


My controller class

import com.formbean.User;
import com.mys.services.UserService;

public class RegistrationController extends SimpleFormController {

private UserService userService;

public RegistrationController() {

public void setUserService(UserService userService) {
this.userService = userService;

protected ModelAndView onSubmit(Object command) throws Exception {
User user = (User) command;
return new ModelAndView("success", "user", user);


Form bean User.java

package com.formbean;

public class User {
private String firstname;
private String lastname;
private String email;
private String telephone;

//setters , getter ()


package com.mys.services;

import com.formbean.User;

public class UserServiceImpl implements UserService {

public void add(User user) {
// TODO Auto-generated method stub
System.out.println("user added successfully");

SEVERE: Neither BindingResult nor plain target object for bean name 'User' available as request attribute java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'User' available as request attribute at org.springframework.web.servlet.support.BindStatus.(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:174) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:194) at org.springframework.web.servlet.tags.form.LabelTag.autogenerateFor(LabelTag.java:129) at org.springframework.web.servlet.tags.form.LabelTag.resolveFor(LabelTag.java:119) at org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:89) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79) at org.apache.jsp.Register_jsp._jspx_meth_form_005flabel_005f0(Register_jsp.java:188) at org.apache.jsp.Register_jsp._jspx_meth_form_005fform_005f0(Register_jsp.java:112) at org.apache.jsp.Register_jsp._jspService(Register_jsp.java:71) at

You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic