This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes why methods of SimpleFormController are overridden from a Class optionally and not mandatory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "why methods of SimpleFormController are overridden from a Class optionally and not mandatory?" Watch "why methods of SimpleFormController are overridden from a Class optionally and not mandatory?" New topic
Author

why methods of SimpleFormController are overridden from a Class optionally and not mandatory?

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 588
Why is SimpleFormController a Class and not an Interface. OnSubmit method is not a mandatory to implement method because it is overriden from SimpleFormController.But shouldnt this functionality be mandatory when we are using a Form? Then shouldnt this been kept in an interface and thus made mandatory to implement?

thanks.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Monica. Shiralkar wrote:Why is SimpleFormController a Class and not an Interface. OnSubmit method is not a mandatory to implement method because it is overriden from SimpleFormController.But shouldnt this functionality be mandatory when we are using a Form? Then shouldnt this been kept in an interface and thus made mandatory to implement?

thanks.


Because Spring is flexible. One can choose either to extends the SimpleFormController or not (by using XML or annotation configuration). We can write simple controller which does not tie to the framework, thus making it's easy for unit testing the controller class.


PM Me If You Want to get Urgent Help on Java Programming
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: why methods of SimpleFormController are overridden from a Class optionally and not mandatory?
 
Similar Threads
Why java has 2 ways to create thread ?
Home methods
Remote Interface and Bean
why to implement interface
Cloneable interface