File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes [Spring MVC]connection between controller and view Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "[Spring MVC]connection between controller and view " Watch "[Spring MVC]connection between controller and view " New topic
Author

[Spring MVC]connection between controller and view

Csaba Szegedi
Greenhorn

Joined: Mar 27, 2010
Posts: 28
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.

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16624

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
 
subject: [Spring MVC]connection between controller and view
 
Threads others viewed
What's next after servlets?
struts2 Vs spring mvc
a conceptual problem with security in spring
NX: URLy Bird 1.3.1 Connection Factory Design
How Spring and Hibernate pair up?
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture