• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

[Spring MVC]connection between controller and view

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I dont understand where is the connection between the controller and view. For instance here is good and short example
http://maestric.com/doc/java/spring/mvc
But, I cant see the connection between
jsp/carList.jsp - list_cars.html

I see the list_cars.html handled by CarListController and what next, how can we arrive at the jsp/carList.jsp ?

Thanks in advance.

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Csaba Szegedi wrote:Hello,

I dont understand where is the connection between the controller and view. For instance here is good and short example
http://maestric.com/doc/java/spring/mvc
But, I cant see the connection between
jsp/carList.jsp - list_cars.html

I see the list_cars.html handled by CarListController and what next, how can we arrive at the jsp/carList.jsp ?

Thanks in advance.



The MVC Architecture is

a request comes in. The DispatcherServlet gets it and delegates to a MappingHandler that looks at the URL and determines the Controller and its method to call, it calls it. The Controller returns something or void. This then goes back to the DispatcherServlet that delegates to ViewResolvers to resolve the view to display.

So in your case, the controller returns probably "carList" and in the Spring configuration there is an InternalResourceViewResolver that adds a string to the front of "carList" hence, "jsp/" and appends ".jsp" to the end of "carList.

Hope that helps

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic