Maven initially builds a basic project (Spring MVC+SPRING+JDBC mysql+)

Source: Internet
Author: User

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+)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.