-webmvc. Therefore, add in pom. xml,
org.springframework
spring-webmvc
4.0.6.RELEASE
Step 4: Configure spring-mvc
The best tutorial is http://docs.spring.io/spring/docs/current/spring-framework-refe
expansion, closed to modification".Some of the core class methods in SPRINGWEBMVC are marked as final. As a developer, you cannot override these methods to provide your own behavior. This is not an absolute requirement, but the principle must be clarified in the mind.For an explanation of this principle, you can refer to the Expert Spring Web MVC and Web flow of Seth Ladd, especially the "A Loot at Desing"
Having just built an MVC framework, I decided to share some of the things I learned during my build. I think whether you are a junior programmer or a senior programmer or a software architect, the first thing you should know when learning and understanding a framework is the principle of the framework and its role and relationship with the jar. This article summarizes the relevant knowledge of the spring fr
The spring framework is dedicated to providing powerful, non-intrusive solutions to complex issues from the very beginning of creation. In spring 2.0, a custom namespace feature was introduced to reduce the number of XML configuration files, from which it was deeply rooted in the core Spring framework (AOP, context, Jee, JMS, Lang, TX, and Util namespaces),
be errors such as the following:[ERROR] ... very long ERROR ...: invalid LOC header (bad signature).Cause: This indicates that it is very likely that there are some dependencies of binary file corruption.How to resolve:Delete ". M2/repository" and then perform the Maven install again download dependency repository. 5, problem #5[ERROR] ... very long errors ...: unresolvedaddressexceptionReason:A, assume that you use the domain name in the settings.xml file agent (such as :p roxy.its.ac.id), it
This is your own reference to the Springside Open source Project Integration Framework, the main integration of spring, Spring MVC, Spring data JPA, hibernate these frameworks, for these frameworks it feels more comfortable or spring data JPA this framework, when writing the
aspect programming, coupling integration, MVC, etc, their respective growth will become even more powerful in the enterprise. Spring has already been added to the J2EE specification, and the J2EE world will be even more exciting ......
It may be that the rigid WEB framework of Struts1 is boring for Spring MVC. Especia
generally used to build restful APIs;
@ControllerUsed to define the controller class, which is the responsibility of the controller in the spring project to forward URL requests from the user to the corresponding service interface (services layer).
@RestControllerThe collection of @ResponseBody and @controller
@RequestMappingProvides routing information that is responsible for mapping the URL to a specific function in the controller.
@Ena
acquisition, in the method directly add HttpServletRequest parameters can be
/**
* Get directly with httpservletrequest
* Access the following method address: http://localhost:8080/Spring-mvc/hello3.do?id=2userName= Xin
* @param request
* @param response
* @return
*
/@RequestMapping (value= "/hello3.do") Public
String test3 (httpservletrequest request,httpservletresponse response) {
int id
In this example, we will build an entry-level Web application using the Spring MVC framework. Spring MVC is one of the most important modules of the spring framework. It is based on a powerful
Spring MVC framework. The bank example shows how to model and build simple applications. The sample application contains some technologies (such as dependency injection) that have been learned, but mainly demonstrates the features of spring MVC.
Before you start, download t
Extjs5.0 from the beginner to the actual development information Management System (ExtJS Foundation, EXTJS5 new features, spring, Spring MVC, Mybatis) video tutorial Download Contact qq:1026270010ExtJS as an excellent JS front-end development framework with its good architecture, rich UI Component library, perfect
[5]. The Springmvc @PathVariable contains Chinese and dot numbers [6]. SPRINGMVC Display the customized Chinese information correctly [7]. Spring MVC Tutorial, QuickStart, in-depth analysis [8]. Springmvc with the Open Tao study
[9]. Simple User management example based on spring3.0.5
, the Controller and business class are saved in two files. The Node rules in the file are identical to those in the console example.
3. Modify the Web. config configuration file
Add the sectionGrup node to the configSections node of the configuration file, add the Spring node to the configuration node, and use the resource node in the context node of the spring
configuration file to mount, as shown in the following servlet context.
The Samplebanking-services.xml file represents an example of the configuration and bean configuration of the Bank application service. If you want to mount more than one configuration file, you can use commas as delimiters in the
Spring MVC
application needs to process user input forms, you can inherit Abstractformcontroller. If you need to process multiple-page input to a form, you can inherit Abstractwizardformcontroller.
The sample application helps to visually learn these features. The bank application allows users to retrieve their account information. In building a banking application, you can learn how to configure the Spring MVC fram
appropriate model and passing it to view rendering. 0x02 Dispatcherservlet
The Spring MVC framework revolves around a dispacherservlet design, Dispacherservlet is used to handle all HTTP requests and responses. As shown in the following illustration:
The following is an HTTP processing process sent to Dispacherservlet: after receiving an HTTP request, Dispacherservlet asks Handlermapping to invoke the app
, HttpServletResponse Respo NSE) {//Create a Modelandview objectModelandview Mav =NewModelandview (); //to add data to a model objectMav.addobject ("msg", "This is my first spring MVC program"); //Set logical view nameMav.setviewname ("/web-inf/jsp/first.jsp"); //returns the Modelandview object returnMav; }}The adapter used in the example (Simplecontroller
Lifecycle of spring MVC
Before using spring MVC, we must understand the spring MVC process, for example:
See some previous instructions: (The handlermapping, handleradapter, handl
mode. Even if the number of packages and classes is very large, you must and only need but you need to ignore the remaining part.
-Spring won't let you repeat your work in vain. It actually utilizes some existing technologies, such as several ORM frameworks, log frameworks, JEE, Quartz, and JDK timers, and other view technologies.
-It is easy to test an application written in Spring because the environment
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.