Expert Spring MVC and Web Flow

(Dana P.) #1

Start the Application


You are now ready to deploy the application. The deployment process is specific to each
servlet container. If you are using Tomcat, simply create a directory named JumpIntoSpringMVC
in the $TOMCAT_HOME/webappsdirectory and place all of the files inside. Be sure to match the file
layout as shown in Figure 4-2.
Once deployed, start your browser and load the URL http://localhost:8080/
JumpIntoSpringMVC/app/home. You should see a page that looks like the one in Figure 4-3.


Figure 4-3.Home page


If you see the home page, then congratulations! If you are experiencing errors, check that
all the files are in the right location and that the web application has been deployed correctly
to your servlet container. You may need to create a WAR file before you can deploy the applica-
tion. Check your servlet container’s documentation for specific deployment instructions.


Request Handling Sequence


Figure 4-4 details the work flow performed when an HTTP request enters the system. Notice
how the DispatcherServletdrives the work flow, taking the ModelAndViewreturned by the
Controllerand then delegating to the ViewResolverto locate the View. As you will see in fol-
lowing chapters, the DispatcherServletcoordinates the full life cycle for the request, called
the processing pipeline. What you are seeing in this diagram is but a small piece of the overall
work performed by the DispatcherServlet. However, it does accurately reflect the important
life cycle events related to the HomeControllerand FlightServiceobjects.


CHAPTER 4 ■JUMP INTO SPRING MVC 63
Free download pdf