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 SimpleFormControllers in Spring MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "SimpleFormControllers in Spring MVC" Watch "SimpleFormControllers in Spring MVC" New topic

SimpleFormControllers in Spring MVC

Meghna Bhardwaj
Ranch Hand

Joined: Jun 08, 2007
Posts: 109
Hi All,

I have a question about the controllers AbstractController and SimpleFormController. From what I understand for read-only dynamic pages AbstractController is the very basic one to use. Whereas SimpleFormController handles both GET and PUT requests - so it serves 2 purposes. Am I right?

The application I am working on has 1 controller behind each dynamic view, when the Submit button on that view is hit it goes to a different Controller. So there is 1 Controller to handle each GET request. I am trying to introduce the SimpleFormController. However, my question is, since SFC handles GET and PUT - how can the controller succeeding this one also be SFC? How can you have 2 successive dynamic views with both SFC? Since the second form is displayed using the 1st SFC, the 2nd SFC will not handle the GET request? (Hope I am making sense)

Also in this case, is it correct to use 2 SimpleFC for consecutive dynamic GET requests? I am not very familiar about when to use SFC - would really appreciate it if someone can explain it to me.

Thanks in advance.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

I'd like to help, but I can't understand what you are trying to ask?

SimpleFormController makes it easy to bind a POJO to a form when displaying it (so, it is filled with some initial values), to accept a form submission into a POJO (i.e. binding submitted values to the POJO properties), and to show field level validation errors.
So, if you need those things, consider using a form controller.

The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
I agree. Here's the link:
subject: SimpleFormControllers in Spring MVC
jQuery in Action, 3rd edition