Spring MVC: Java template engine Thymeleaf (2)
This article was originally designed to directly introduce Thymeleaf's view parsing, but considering the convenience of learning, we decided to build a spring-mvc first.
All the following processes require only one notepad and JDK.
Step 1: Use maven to build a web app.
mv
development, and many MVC development frameworks have emerged, spring MVC is undoubtedly a classic and concise one. Angular, React, and Vue. the front-end MVC and development kit that js brings together a more focused isolation concept, such as RESTful, MicroService, and frontend and backend separation. enterprise-lev
CatalogueFirst, preface two, Spring MVC core class and interface three, spring MVC core flowchartIv. Spring MVC dispatcherservlet DescriptionFive. Description of spring
In a recent project, the use of SPRINGMVC, MyBatis, found a very annoying problem: transaction management does not work!! Online access to a large number of information, tried various solutions, also failed to solve the problem!Spring Version: 3.0.5MyBatis Version: 3.2.21, applicationcontext.xml configuration:2, Springmvc.xml configuration:As a result of the previous SPRINGMVC, the principle of smattering, has been to consider whether the AOP configur
1. If the MyBatis XML file is placed under the Java folder (idea does not compile the XML file for the SRC Java directory), you need to include the following code in the Pom.xml:*.xml2.mybatis configuration file do not appear classpath3.spring integration with MyBatis key configurations"sqlsessionfactory" class="Org.mybatis.spring.SqlSessionFactoryBean"> "DataSource" ref="DataSource"/> "mapperlocations"Value="Classpath:mybatis/xml/*.xml"/> "configloca
Originally wanted to write down spring+springmvc+hibernate integration of the article temporarily do not write the direct attached source code, there is a need for direct download to see it. There are previous articles in the SPRINGMVC source code before the article is simply said to build the environment to access the page successfully. This source code has simulated additions and deletions and file upload, conversion JSON entity class validation and
Spring MVC Framework
The Spring framework provides a full-featured MVC module for Building Web applications. Using spring-pluggable MVC Architecture, you can choose whether to use a built-in s
-bidi-language:#0400;}-->
InWeb. xmlThe initialization configuration file is configured in(Applicationcontext. xml,Application-Flex.xml)Therefore, you mustSRCCreate the correspondingXMLFile(The file name must beWeb. xmlThe configuration file name set in is the same; otherwise, an error will be reported during loading.).
6. Configure applicationcontext. xml
VII. Spring MVC ConfigurationUsing
Recently, the spring MVC framework is used in the project. After reading some documents, I have forgotten it.
1. The spring MVC Architecture adopts the command + controller mode. The overall framework is shown in:
The core controller is dispatcherservlet, and the returned view object is the modeandview object.
2. In t
In today's MVC Framework, it seems that webwork2 has gradually become the mainstream, and the combination of webwork2 + springframework has become increasingly popular. This seems to mean that the MVC framework provided by spring is far worse than webwork2, so we use webwork2 in succession. Indeed, spring's MVC framewo
In today's MVC Framework, it seems that webwork2 has gradually become the mainstream, and the combination of webwork2 + springframework has become increasingly popular. This seems to mean that the MVC framework provided by spring is far worse than webwork2, so we use webwork2 in succession. Indeed, spring's MVC framewo
Spring 4 + jpa (hibernate 3/4) + spring mvc multi-data source configuration (2) + Druid connection pool, mvcdruid
Pick up a blog post (http://www.loveweir.com/html/18.html), no database connection pool, purely using the official link of jpa.
Therefore, we need to add the connection pool. In this article, we use the Druid connection pool to configure multiple data
) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8C/CF/wKiom1h4mcWxh7SpAACc0dLT8Us684.png "style=" float : none; "title=" 1.png "alt=" Wkiom1h4mcwxh7spaacc0dlt8us684.png "/>650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8C/CB/wKioL1h4mcagG8qCAACnGTx9wMk536.png "style=" float : none; "title=" 2.png "alt=" Wkiol1h4mcagg8qcaacngtx9wmk536.png "/>Clicking Run as->maven Install will download a lot of jar packages and the last build succeeds.650) this.width=650; "src=" Http://s5.51
; Property>Bean>3. Modify the language of the running environment after successful login // if ("EN" .equals (Logonuser.getlanguage ()) {Locale Localeen = new Locale (" en "," en " else if ("JA" .equals (Logonuser.getlanguage ())) {Locale LOCALEJP = new Locale ("ja", "JP" else {Locale Localeen = new Locale ("en", "en" 4. Define methods for acquiring classical Chinese contentprotected string GetMessage (String code,object ... params) {return messagesource.getmessage (code
Controller control page Jump processing foreground background data interactive access ServiceDAO Layer: @Repository Database access layer additions and deletions to the JPA specification of the Hibernate JAP warehouse JPA Automatic parsing method name using @query (sql| | HqlDomaon layer: The entity bean is the table of the database in which the @entity @Table correspondence between the PojoService Layer: @Service Implementation some JPA can parse without access to the DAO layer can not be resol
-define the location of the JSP file - Beanclass= "Org.springframework.web.servlet.view.InternalResourceViewResolver"> Propertyname= "prefix"value= "/web-inf/views/"/> Propertyname= "suffix"value= ". jsp"/> Propertyname= "Viewnames">Array>valuetype= "Java.lang.String">login*value>Array> Property> Bean>If you have multiple file paths (for example: webapp/), you can define multiple resolver, configure different viewnames or different mediatype to differentiate which
the message body itself is a JSON.This way, spring will do the processing when it receives the JSON and convert it to an object. This is not the time to use Request.getparameters to obtain this request information.See requests and responses from Jemeter:
Post Http://localhost:8060/tstbody
Post data:
{' OpenID ': ' JMeter ', ' sign ': ' Sign '}
[no cookies]
Request Headers:
connection:keep-alive
content-type:application/json
:
content-length:33
ho
This article summarizes the basic configuration of spring MVC by first pasting a screenshot of my project's catalog, with some extra files that you don't have to care about:
Some of the jar bags used in this:
Next is the configuration of Web. XML:
Next is Springmvc-servlet.xml:
These are the most basic configurations of spring
parameter name and the model attribute field are automatically populated if matched. This mechanism is useful for binding form submission data to object properties.When @modelattribute annotations are used for method parameters, it has the dual function of "save/Fetch". First, it extracts the data from the model and assigns the corresponding parameters, if it is not already present in the model, instantiates one and stores it in the model, and second, once the data object already exists in the
Spring MVC integrated Velocity template
Spring MVC
We used struts2 when using the traditional configuration file in a way that did not use the legendary 0 configuration. SPRING3 MVC can be thought of as having 100% 0 configured (in addition to configuring
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.