so on. It means that we probably need more than one representation of a resource, for example one that contains the whole page wi Th all menus, one of the contains just the content, and maybe one that presents the data in a popup style.Progressive enhancement is a unobtrusive-in-a-do, so we don't have JavaScript generating HTML, we just use JavaScript For rendering, the history management, refreshing and validating based on server-generated data.The movie Database–an example applicationLearn th
Original address: Http://tianmaying.com/tutorial/spring-mvc-quickstart Environment preparation
A hand-called text editor (such as Vim, Emacs, Sublime text) or IDE (Eclipse, Idea Intellij)
Java environment (JDK 1.7 or later)
Maven 3.0+ (Eclipse and Idea IntelliJ built-in, if using the IDE and not using command-line tools can be installed)
One of the simplest web appsUsing the
Objective
Learn the simple knowledge ahead Spring Web and then learn the higher-order Web techniques.
Advanced technology substitution Scenarios for spring MVC configuration Custom Dispatcherservlet configurationIn the fifth chapter we have written the following code.public class Spitterwebinitializer extends Abstractannotationconfigdispatcherser
Global Exception Handling of spring MVC and mvc Exception Handling
1. Use SimpleMappingExceptionResolver to handle exceptions
Add the following content to the Spring configuration file applicationContext. xml:
Note: SimpleMappingExceptionResolver can be used for exception handling. It has the advantages of simple inte
Spring MVC pattern example (using a Decoupling Controller), mvc
Product
Package com. mstf. bean; import java. io. serializable;/*** Product class, which encapsulates some information, including three attributes * @ author wangzheng **/public class Product implements Serializable {private static final long serialVersionUID = 1L; private String name; private String
operation of persistent data is completed by the session, the only similarity between the session and the Web-httpsession is that the name is a bit like the other, no matter what the other place. NBSP;NBSP; spring and Hibernate: Hibernate sessionfactory, similar to DataSource in JDBC. Is the source of data access, spring first grabbed sessionfactory this faucet. Talent has a
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
Build a multi-modular spring MVC + Spring boot project using MAVEN, completely based on Java Config
First, create a new MAVEN project, the template uses QuickStart, the project name multiboot pom.xml configuration:
This adds dependency management for all of the sub modules and changes the package mode to POM
Second, in Eclipse, remove everything except pom.xm
Before using spring MVC, let's first understand why we're using spring MVC. We can look at the simple development of Java Web in this question.1. The servlet development phaseIn the 90 's, with the rapid development of Internet and browser, the B/S model based on the browser developed with the hot development. Sun prop
layer and the business logic layer is too close, so between the presentation layer and the business logic layer to add a layer of control layer, by judging the performance layer from the request (that is, the user's request) to decide which business processing logic to invoke. This gradually evolved the MVC framework.MVC,That is, the model---view---controller, although MVC is also three layers, but not cor
STRUTS2 uses filter as the front-end controller to process the request, and filter distributes the request to different business controller actions based on the Struts.xml configuration, and the action processes the specific business logic. After the action has finished processing the business, filter will find the corresponding result from the Struts.xml based on the string it returns, and eventually the request is forwarded to the page by result.The idea of this implementation is basically c
MyBatis Configuration
Reprint please declare reprint Source: http://blog.csdn.net/qq5132834/article/details/52227666
In the previous section, referring to the use of an important tool "Mybatis-generator" in MyBatis, this section will cover the configuration of "MyBatis". The content Code of this section continues to be written on the basis of section fifth, "Separating spring, Spring
SpringMVC (Spring MVC)
Let's first look at the SpringMVC diagram.
Create a project, create a config resource folder, and configure the file
Web. xml:
Index. jsp
SpringMVC
Org. springframework. web. servlet. DispatcherServlet
ContextConfigLocation
Classpath: applicationContext-mvc.xml
Spring Source code reading: How does Spring MVC process HTTP requests?Through reading the source code, Spring MVC can understand the initial process of ApplicationContext and the initialization process of Spring
The spring container first loads the parent container generated by Servletcontextlistener (corresponding applicationcontext.xml), and SPRINGMVC (corresponding Mvc_dispatcher_ Servlet.xml) produces a sub-container. The instance of the @service annotation assembled when the sub-container controller is scanned for assembly is not transacted, that is, a service with no transaction capability, and the service that the parent container initializes is a guar
The springmvc framework is mainly centered around the dispatcherservlet core. It intercepts requests and assigns them to the corresponding processor for processing, and then returns the results to users. Including annotation-driven controllers, request and response information processing, view parsing, localization parsing, file uploading parsing, exception handling, form binding, etc.
Springmvc is implemented based on model2. Using the processor to separate models, views, and controls, springm
Spring mvc uses the @ InitBinder label to bind the form data. mvc @ initbinder
In SpringMVC, bean defines the Date, double, and Other types. If no processing is done, the Date and double cannot be bound.
The solution is to use the @ InitBinder tag provided by spring mvc.
In
Spring integrates spring MVC Controller and Struts2 Action control layer Bean's default Scope
Spring's Controller scope when integrating Spring MVC is a singleton by default.
When Spring integrates Strut2, Action is a prototype of
can Customi Ze the CORS configuration using @CrossOrigin attributes.You can even with both controller and method level CORS configurations, Spring would then combine both annotation attributes To create a merged CORS configuration.@CrossOrigin(MaxAge= 3600)@RestController@RequestMapping("/account")Public Class AccountController {@CrossOrigin(Origins= "Http://domain2.com")@RequestMapping("/{id}")Public AccountRetrieve(@PathVariable LongId) {// ...} @R
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.