Meaningless Drivel is fun!
The moose likes Spring and the fly likes spring mvc: defining controller through @controller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "spring mvc: defining controller through @controller" Watch "spring mvc: defining controller through @controller" New topic

spring mvc: defining controller through @controller

Manuj Roy

Joined: Feb 17, 2011
Posts: 7


Can somebody help on understanding, that whether by declaring own constructor through DefaultAnnotationHandlerMapping uses some implementation of Controller interface or not. if not then how does model data is nd put in the HttpSession automatically?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

Moving this question to the Spring forum.

An IDE is no substitute for an Intelligent Developer.
Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

On newer versions of Spring the RequestMappingHandlerMapping is used not the one you mentioned. The @Controller annotation is just a marker interface used to allow the class to be found and registered by the RequestMappingHandlerMapping, its an empty interface there is no implementation. The second part of your question has nothing to do with the first part. When the DiispatcherServlet is near through handling the request one of the last steps is for the resolved view to render the response. At this point the view that was resolved will expose the model as request attributes not put them on the session. The exception here is if you used the @SessionAttributes annotation on your controller.

[How To Ask Questions][Read before you PM me]
Himanshu bisht bebo

Joined: Jun 12, 2012
Posts: 16
The @ controller interface make simple java class act as controller .The @requestmaping specify the url to which this controller is run and all the data in request bind to this class .To bind data in to response use model object
I agree. Here's the link:
subject: spring mvc: defining controller through @controller
It's not a secret anymore!