SpringMCV Introduce :
Spring MVC It's based on Java Realized. MVC Design pattern request driven type lightweight Web frame , That is to use MVC The idea of architecture pattern , take web Layer to decouple responsibilities , Based on request driven , That is to use the request - Response model , The goal of the framework is to help us simplify development
MVC Pattern :
MVC The framework provides the model - View - Control architecture and can be used to develop flexible 、 Loosely coupled web Components of the application .MVC Patterns lead to different aspects of the application ( Input logic 、 Business logic and UI Logic ) The separation of , It also provides loose coupling between these elements .
Model Model
Encapsulates application data , And usually they are made up of POJO form .
View View
Mainly used to present model data , And usually it generates what the client's browser can interpret HTML Output .
controller Controller
It is mainly used to process user requests , And build the appropriate model and pass it to the view rendering .
What are the frameworks of the control layer :
Struts 1.0 1.1
Spring mvc
Struts2 be based on webwork
In terms of performance :
Jsp+servlet > struts1.1 > spring mvc > struts2
establish demo
1 , Create a dynamic web engineering .
2 , Join in Jar package .
3 , stay web.xml Middle configuration DispatcherServlet.
4 , Join in Spring MVC Configuration file for .
5 , The processor that writes the request , And marked as processor .
6, Authoring views .
create profile :springmvc.xml
2、 Selective dependency :mvc、contxet、aop( See what you need )
end : The specific content
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
<!-- Scanning package -->
<context:component-scan base-package="com.jd.springmvc"></context:component-scan>
<!-- view resolver -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"></property> --- Match under which address
<property name="suffix" value=".jsp"></property> --- suffix
</bean>
</beans>
stay web.xml Middle configuration DispatcherServlet: Front controller
<!-- register springmvc -->
<servlet>
<servlet-name>bookstore</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:Spring-mvc.xml</param-value>---spring Lu Jin
</init-param>
<load-on-startup>1</load-on-startup>---- in 1 The value of 1,2,3,4,5 It means that the lower the value of the priority positive number is , The servlet The higher the priority , The more the app is loaded at startup
</servlet>
<servlet-mapping>
<servlet-name>bookstore</servlet-name>
<url-pattern>/</url-pattern>--- Filter all requests
</servlet-mapping>
【Eclipse】springMVC More articles about configuration
- springMVC Introduction and configuration
Spring MVC Of Controller Used to process user requests .Controller amount to Struts 1 Inside Action, Their implementation mechanism . The principle of operation is similar . Controller It's an interface , In general, direct inheritance A ...
- SpringMVC The agreement of introduction is better than configuration
SpringMVC The agreement of introduction is better than configuration The so-called convention is better than configuration, which means that in the process of program development, we can agree on some rules to make us less to configure and write code . In such a simple sentence, maybe you don't quite understand what convention is better than configuration , No problem , After the play ...
- SpringMVC Framework entry configuration IDEA The structures, Maven project
The original : I'm just learning SpringMVC I met all kinds of strange problems when I was young , The posts on various technical forums on the Internet are also uneven , It's difficult to achieve good results in one step , Here I will write the summary of my configuration here for you to learn SpringMVC My colleagues are learning together ...
- [ turn ]SpringMVC Framework entry configuration IDEA The structures, Maven project
The original : I'm just learning SpringMVC I met all kinds of strange problems when I was young , The posts on various technical forums on the Internet are also uneven , It's difficult to achieve good results in one step , Here I will write the summary of my configuration here for you to learn SpringMVC My colleagues are learning together ...
- springmvc be based on java Implementation of configuration
In this case github Address :https://github.com/zhouyanger/demo/tree/master/springmvc-noxml-demo 1. Introduce Built before SpringMvc term ...
- Eclipse Conduct C/C++ Development ——Eclipse+CDT+MinGW The configuration and use of
http://hi.baidu.com/ltb6w/item/3a51f11926fda60ce75c361d Eclipse Conduct C/C++ Development ——Eclipse+CDT+MinGW The configuration and use of ...
- 【 turn 】Eclipse+PyDev install and configure
Original website :http://www.51testing.com/html/67/589567-866611.html Python There are many tools for development , among Eclipse+Pydev It's the most common . This paper introduces briefly ...
- eclipse php Development environment configuration
What is commonly used is eclipse+pdt. I download it directly Eclipse for php :http://www.eclipse.org/downloads/packages/eclipse-php-deve ...
- Spring-mvc Introduce
Spring-mvc Introduce 1.1 Popular frames on the market Struts2( More ) Springmvc( It's more and it's on the rise ) Struts1( About to be eliminated ) other 1.2 spring-mvc structure 1 ...
Random recommendation
- The embedded linux Summary of application migration methods
The embedded linux Summary of application migration methods I've been doing it some time ago openCapwap The migration and debugging work of , Now the work is coming to an end , Write this document to summarize the previous work , Under the share openCapwap Experience and perception in the process of transplantation . Jiang Hao ...
- solve sublime text3 file name , A small way
solve sublime text3 file name , A small way It's always a folder named in English , I found out a few days ago , In Chinese , There is a garbled problem in naming the folder . This evening, , I also went to Baidu on the Internet for a lot of solutions , It seems that most of them don't have much ...
- redis Cluster environment construction -redis Cluster management
Cluster architecture (1) be-all redis Nodes interconnect with each other (PING-PONG Mechanism ), Internally, binary protocols are used to optimize transmission speed and bandwidth . (2) Node fail It only takes effect when more than half of the nodes in the cluster are detected to have failed . (3) The client and redi ...
- HDU 3183 A Magic Lamp
Direct simulation If the latter is smaller than the former , Then all the time forward pop() fall Defend him : #include<iostream> #include<cstring> #include& ...
- C++ rewrite (override)、 heavy load (overload)、 redefinition (redefine) And virtual function calls
One . Basic concepts about C++ Functions with the same name but different parameter lists or return values often appear in , There are three main situations : 1. Function rewriting (override) Function overloading mainly realizes polymorphism between parent class and child class , The definition in the subclass is the same as the name in the parent ...
- AssetBundle pack
Lay the foundation for hot update (xlua\tolua) material . Source link :http://www.sikiedu.com/course/74/task/1812/show One .AssetBundle The definition and function of 1,As ...
- shiro Login authentication
newly build maven file create a simple project shiro.ini file [users] root=123456 log4j.properties log4j.rootLogger=I ...
- logback-MDC Log unique ID
Customize LogbackFilter: import org.slf4j.MDC; import javax.servlet.*; import javax.servlet.annotation.WebF ...
- HTML 5 Drag and drop drag dragend dragover ....
Drag and drop (Drag and drop) yes HTML5 Part of the standard . // http://www.w3school.com.cn/html5/html_5_draganddrop.asp dataTrans ...
- tmux Basic usage
C representative Ctrl, Press down Ctrl+b after tmux There will be no reaction , Just press one more button and you'll get a reaction . tmux # Turn on tmux tmux ls # Show existing tmux list (C-b s) tmux attach-s ...