Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

spring form submission  RSS feed

sri vas
Posts: 1
  • Mark post as helpful
  • send pies
  • 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=""%>
<%@taglib prefix="spring" uri=""%>
<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=""></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=""

<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>

</beans> 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;

=========================================================================== 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) { = country;
public String getState() {
return state;
public String getCountry() {
return country;

public Address() {


[ April 16, 2008: Message edited by: sri vas ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!