Technology selection:
I. Project CONSTRUCTION:
1) Create a MAVEN project (I have an introduction in my blog)
Choose Aptach's Maven-archetype-webapp
Fill in Groupidhe Artifactid, etc.
Confirm Project Name
The Maven plugin automatically generates the project structure
2) Add another directory
Add Java directory under/src/main (name yourself), set as source root directory
Note: You can add a catalog of test-related code in the SRC directory if necessary
Create the following directory structure (self-determined)
Com.xx.common
Com.xx.vip
. Entity
. DAO
. function
. Web
-formbean
-handler
Build static (WebApp) under the webapp/web-inf/views (Put JSP page)
Note: web. XML version header must be above 3.0
3) Modify the language level of the project and module to java1.8
The default Languagelevel and Javacompiler are all 1.5.
You need to add the following code in Pom.xml to make the version of the MAVEN mutation plugin Maven-compiler-plugin
<Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>2.3.2</version> <Configuration> <Source>1.8</Source> <Target>1.8</Target> </Configuration> <plugin><Plugins>
Two. Integrated SPRINGMVC
Search for dependent libraries on the http://mvnrepository.com/site
1) Add dependency in Pom.xml
Spring-mvc
Servlet-api
Jstl
2) Add spring-mvc.xml Config file in src/main/resources directory
A) Add note driver <mvc:annotation-driven/>
b) Registering the View parser
c) Scan the MVC component
3) Configure the SPRING-MVC front-end controller in Web. XML dispatcherservlet
A) configuration is initialized with service startup
b) configuration parameter contextconfiglocation, which points to the path of the SPRING-MVC (default in web-inf/and Servlet-name)
c) Configure servlet-mapping (can process only *.do requests)
4) Web. XML configuration request and answer character encoding processor
Maven initially builds a basic project (Spring MVC+SPRING+JDBC mysql+)