File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Application Frameworks and the fly likes spring form submission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "spring form submission" Watch "spring form submission" New topic

spring form submission

sri vas

Joined: Apr 16, 2008
Posts: 1
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 ]
subject: spring form submission
It's not a secret anymore!