當前位置 主頁 > 服務器問題 > Linux/apache問題 > 最大化 縮小

    Spring MVC 簡單的hello world的實現

    欄目:Linux/apache問題 時間:2020-01-19 00:40

    一、項目搭建

    1、可以在新建項目的使用Spring MVC框架。或者創建一個簡單的項目之后再用Add Framework Support來添加Spring MVC框架。

    2、刪除自動生成的lib的jar包,使用pom文件來進行管理包。目錄結構如下圖。

    3、pom文件。加載完成之后才能進行下一步。

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     
     <groupId>com.zxj</groupId>
     <artifactId>zxj-spring-mvc</artifactId>
     <version>1.0-SNAPSHOT</version>
     
     <name>zxj-spring-mvc</name>
     <url>http://www.example.com</url>
     <packaging>war</packaging>
     
     <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <maven.compiler.source>1.7</maven.compiler.source>
      <maven.compiler.target>1.7</maven.compiler.target>
      <spring.version>4.3.18.RELEASE</spring.version>
     </properties>
     
     <dependencies>
      <!--測試-->
      <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.12</version>
       <scope>test</scope>
      </dependency>
      <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-test</artifactId>
       <version>${spring.version}</version>
       <scope>test</scope>
      </dependency>
     
      <!--Spring-->
      <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
       <version>${spring.version}</version>
      </dependency>
      <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-aop</artifactId>
       <version>${spring.version}</version>
      </dependency>
      <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-aspects</artifactId>
       <version>${spring.version}</version>
      </dependency>
     
      <!--spring mvc-->
      <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
       <version>${spring.version}</version>
      </dependency>
      <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-webmvc</artifactId>
       <version>${spring.version}</version>
      </dependency>
      <dependency>
       <groupId>javax.servlet.jsp.jstl</groupId>
       <artifactId>jstl-api</artifactId>
       <version>1.2</version>
      </dependency>
     </dependencies>
     
     <build>
      <finalName>${project.artifactId}</finalName>
      <plugins>
       <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.1.0</version>
       </plugin>
       <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.5.2</version>
       </plugin>
      </plugins>
     </build>
    </project>
    
    下一篇:沒有了
777亚洲人成视频免费视频