img
returned, and the JavaScript application performs "partial" updates of the view with the received data.
Figure 17-1 shows this concept.
Figure 17-1. The MVC pattern
Figure 17-1 illustrates a commonly used web application pattern, which can be treated as an
enhancement to the traditional MVC pattern. A normal view request is handled as follows:
Request: A request is submitted to the server. On the server side, most
1.
frameworks (for example, Spring MVC, Struts, and so on) will have a
dispatcher (in the form of a servlet) to handle the request.
Invokes: The dispatcher dispatches the request to the appropriate controller
2.
based on the HTTP request information and the web application
configuration.
Service Call: The controller interacts with the service layer.
3.
Response: The controller updates the model and, based on the execution
4.
result, returns the corresponding view to the user.
In addition, within a view, Ajax calls will happen. For example, say the user is browsing data within a
grid. When the user clicks the next page, instead of a full page refresh, the following flow will happen:
Request: An XMLHttpRequest is prepared and submitted to the server. The
1.
dispatcher will dispatch the request to the corresponding controller.
Response: The controller interacts with the service layer, and the response data
2.
will be formatted and sent to the browser. No view is involved in this case. The
browser receives the data and performs a partial update of the existing view.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home