环境:IDEA 2018.1,java环境配置 ,tomcat就不多说

多图:请慎入

知识储备建议:

1:熟悉IDEA工具 https://github.com/judasn/IntelliJ-IDEA-Tutorial 或者https://blog.csdn.net/qq_35246620/article/details/61191375

2:先学习spring (记住2个核心 ioc 和aop)

3:了解一下servlet (springMvc 底层都离不开原始ServletAPI。)

springMvc介绍:套用网上的

SpringMVC 是一种基于Java 的实现MVC 设计模型的请求驱动类型的轻量级Web 框架,属于 Spring

FrameWork 的后续产品,已经融合在Spring Web Flow 里面。Spring 框架提供了构建 Web 应用程序的全功
能 MVC 模块。使用 Spring 可插入的 MVC 架构,从而在使用Spring 进行WEB 开发时,可以选择使用 Spring
的 Spring MVC 框架或集成其他MVC 开发框架,如Struts1(现在一般不用),Struts2 等。
SpringMVC 已经成为目前最主流的 MVC 框架之一,并且随着Spring3.0 的发布,全面超越 Struts2,成
为最优秀的 MVC 框架。

它通过一套注解,让一个简单的Java 类成为处理请求的控制器,而无须实现任何接口。同时它还支持
RESTful 编程风格的请求。

springMvc入门一

废话不多说,拿起来IDEA就干。

需求:

springMvc入门一

 

 

 

 

 1:File=> New Project=>Empty Project

 

 2:File=> New Model 如图: 

创建maven项目

springMvc入门一

 

springMvc入门一

 

 

 springMvc入门一

插曲:

如果创建项目过慢,输入<archetypeCatalog,internal>

仓库镜像文件setting.xml配置说明 https://blog.csdn.net/qq_27093465/article/details/52957253

我的配置(现在可用,镜像地址以后也可能失效) 嫌麻烦直接复制(原因:外国的地址下载太慢,你懂的)

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
    <pluginGroups />
    <proxies />
    <servers />
    
    <localRepository>G:\myRepository\repository</localRepository>
    
    <mirrors>  
<mirrors>
        <!-- 阿里云仓库 -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
     
        <!-- 中央仓库1 -->
        <mirror>
            <id>repo1</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo1.maven.org/maven2/</url>
        </mirror>
     
        <!-- 中央仓库2 -->
        <mirror>
            <id>repo2</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo2.maven.org/maven2/</url>
        </mirror>
    </mirrors>
    </mirrors>  
  <profiles>  
    <profile>  
       <id>nexus</id>   
        <repositories>  
            <repository>  
                <id>nexus</id>  
                <name>local private nexus</name>  
                <url>http://maven.oschina.net/content/groups/public/</url>  
                <releases>  
                    <enabled>true</enabled>  
                </releases>  
                <snapshots>  
                    <enabled>false</enabled>  
                </snapshots>  
            </repository>  
        </repositories>  
          
        <pluginRepositories>  
            <pluginRepository>  
            <id>nexus</id>  
            <name>local private nexus</name>  
            <url>http://maven.oschina.net/content/groups/public/</url>  
            <releases>  
                <enabled>true</enabled>  
            </releases>  
            <snapshots>  
                <enabled>false</enabled>  
            </snapshots>  
            </pluginRepository>  
        </pluginRepositories>  
    </profile></profiles>  
    
</settings>
View Code

相关文章: