• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

spring form submission

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, any body please help me...,,please

I am trying to make this work since 1 day, i dont know where is wrong..

I don't have any clue why it is giving this below error:

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'address' available as request attribute
1).Home.jsp used for submission

<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<body bgcolor="yellow">
<form:form action="login.htm" method="post" commandName="address">
<spring:message code="Home.state" ></spring:message>
<form:input path="state"/><br/>
<spring:message code="Home.country"></spring:message>
<form:input path="country"/><br/>
<input type="submit"/>
"Test-servlet.xml" is my spring application context file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<bean id="simpleUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<prop key="/JSP/login.htm">usercontroller</prop>

<bean id="address" class="com.spring.address.Address"/>

<bean id="usercontroller" class="com.spring.controller.UserController">

<property name="commandName" value="address"/>
<property name="commandClass" value="com.spring.address.Address"/>

<property name="formView" value="Home" />
<property name="successView" value="Results" />

<!-- <property name="address" ref="addr"/> -->


<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/JSP/"></property>
<property name="suffix" value=".jsp"></property>


===========================================================================UserController.java my controller class:

public class UserController extends SimpleFormController {

private UserController(){
System.out.println("Enter in the UserController Constructor..");

protected Object formBackingObject(HttpServletRequest request) throws Exception {
Address address = new Address();
return address;

protected ModelAndView onSubmit(Object command){
System.out.println("Enter in the onSubmit method..");
Address address = (Address)command;

//return new ModelAndView(getSuccessView());
ModelAndView mav = new ModelAndView(getSuccessView());
mav.addObject("address", address);
return mav;

Address.java is my Command class ,POJO

public class Address implements Serializable {
private String state;
private String country;

public void setState(String state) {
this.state = state;
public void setCountry(String country) {
this.country = country;
public String getState() {
return state;
public String getCountry() {
return country;

public Address() {


[ April 16, 2008: Message edited by: sri vas ]
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic