wood burning stoves 2.0*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "spring mvc: defining controller through @controller" Watch "spring mvc: defining controller through @controller" New topic
Author

spring mvc: defining controller through @controller

Manuj Roy
Greenhorn

Joined: Feb 17, 2011
Posts: 7

Hi,

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?

Regards,
Manuj
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16160
    
  21

Moving this question to the Spring forum.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1672
    
    7

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
Greenhorn

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: spring mvc: defining controller through @controller