Spring MVC Tutorial, Quick Start, in-depth analysis

Source: Internet
Author: User
Tags spring mvc tutorial

Catalogue
First, preface two, Spring MVC core class and interface three, spring MVC core flowchart

Iv. Spring MVC dispatcherservlet Description

Five. Description of spring MVC parent-child context

Vi. springmvc-mvc.xml configuration file fragment explains how spring MVC accesses static files, such as Jpg,js,css

How the spring MVC request maps to a method in a specific action

Ix. interceptors in spring MVC: X. How spring MVC uses interceptors

Xi. How spring MVC implements global exception handling

12. How spring MVC Logs global exceptions to the log

13. How to do junit Unit test for action in Spring3 MVC

14. Spring MVC forwarding and redirection (with parameter redirection)

XV, Spring MVC handles AJAX requests

16. Spring MVC instructions for writing several configuration files

17. How spring MVC obtains spring-managed beans

18. Spring MVC Multi-View Controller

19, What exactly did the work 20, this article Springmvc.xml configuration file is the core, here to a

First, preface:

Choosing an excellent MVC framework for the development team is a difficult task, and it requires a high level of experience and expertise in a wide range of possible scenarios. One of your decisions will affect the team's future years. There are too many things to consider:

1, easy to use, to improve the development efficiency. Put a small amount of energy on the frame, and most of the energy is on the business.

2, excellent performance, this is a most eye-catching topic.

3. Try to use the public framework (avoid the use of niche, private framework), the newly recruited developers have a number of technical accumulation in this area, reduce the impact of mobility and re-adaptation.

If you're still worrying about this, this is the best thing for you. Choose Spring MVC.

Spring MVC is currently the best MVC framework, and since the release of Spring 2.5, ease of use has been greatly improved thanks to the support for annotation configurations. The Spring 3.0 is more complete and achieves the transcendence of Struts 2. More and more development teams are now choosing Spring MVC.

Struts2 is also a very good MVC architecture, with many advantages such as good structure, interceptor ideas, and rich functionality. But here is the disadvantage, Struts2 due to the use of value stack, OGNL expression, struts2 tag library, etc., will lead to the performance of the application degradation, should avoid the use of these features. The STRUTS2 multi-layer interceptor, multi-instance action performance is very good. You can refer to an article I wrote about the comparison between spring MVC and Struts2 and Servlets, "Struts2, Springmvc, servlet (JSP) performance comparison test"

Advantages of SPRING3 MVC:

1, Spring3 MVC is simple to use, low learning cost. The learning difficulty is less than the redundant function that STRUTS2,STRUTS2 does not use too much. Oh, of course this is not the deciding factor.

2, Spring3 MVC is easy to write a good performance program, Struts2 to be careful to write good performance program (refers to the MVC part)

3, Spring3 MVC flexibility is beyond your imagination, the spring framework of the extension of the legendary, Spring3 MVC certainly will not lag behind, not because of the use of the MVC framework and feel any restrictions.

STRUTS2 's many advantages:

1, the veteran of the well-known framework, from the Struts1 accumulated a large number of user groups. Rich technical documentation.

2, other aspects slightly ... (hehe, isn't it fair?) )

Spring's official Download URL is: http://www.springsource.org/download (this article uses the Spring 3.0.5 version)

Reprint please indicate source: Original address: http://elf8848.iteye.com/blog/875830

second, the core class and interface:

Let's take a look at some important interfaces and classes. Now do not know what they are do not matter, first mixed face ripe, for later know them to play a foundation.

Dispatcherservlet--Front Controller

Handlermapping interface--mapping of processing requests

Implementation classes for the Handlermapping interface:

simpleurlhandlermapping mapping a URL to a controller through a configuration file

defaultannotationhandlermapping maps a URL to a controller class via annotations

Handleradapter interface--mapping of processing requests

The Annotationmethodhandleradapter class, through annotations, maps a URL to the method of the Controller class

Controller interface--controllers

Since we have used the @controller annotation, the class that added the @controller annotation annotation can assume the responsibility of the Controller (Action),

So we don't have to use this interface.

Handlerinterceptor interface--Interceptor

Without graphs, we implement this interface ourselves to complete the work of the Interceptor.

Implementation class for the Viewresolver interface

The Urlbasedviewresolver class passes a configuration file and gives a view name to the

Internalresourceviewresolver class, than the above class, joined the JSTL support

View interface

Jstlview class

Localresolver interface

Handlerexceptionresolver interface--Exception handling

Simplemappingexceptionresolver Implementation Class

Modelandview class

No diagram.

Third, core flowchart

This picture is my personal painting, there is not rigorous place, we deal with the look. It's better than not watching.

Java enterprise-Class generic rights security framework source SPRINGMVC MyBatis or Hibernate+ehcache Shiro Druid Bootstrap HTML5

"Java Framework source code download"

Spring MVC Tutorial, Quick Start, in-depth analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.