• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

spring mvc: defining controller through @controller

 
Manuj Roy
Greenhorn
Posts: 7
Java MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18281
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this question to the Spring forum.
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Himanshu bisht bebo
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic