File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Use of formBackedObject Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Use of formBackedObject" Watch "Use of formBackedObject" New topic

Use of formBackedObject

Parthiban Malayandi
Ranch Hand

Joined: Apr 15, 2008
Posts: 70
Hi all,

I have just started to learn Spring MVC and learned about formBackingObject method.

I have wrote a simple program to understand the concept .


Person Class

I came to know that formBackingObject is called twice ( first time when form is loaded with GET request and when it is submitted with POST method) but every time I'm getting null values
when I print the Person object where as I'm getting values in onSubmit method.

Can you please explain what is the significance of formBackingObject method ?

Thanks in advance
daniel webber

Joined: Aug 16, 2013
Posts: 1
I know this is a really old post but since it was not answered and it comes up in searches I figured I would answer it.

You have to make you backing object a session object by adding this to your constructor:

your backing object now has to be serializeable for the code to run but it will not get a second call to the getFormBackingObject when it is submitted.
Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

Hi daniel,

Welcome to the Ranch, thanks for taking the time to register and answer this.

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Use of formBackedObject
It's not a secret anymore!