文章目錄
- 一、編寫第一個 Spring MVC 程序
一、編寫第一個 Spring MVC 程序
-
代碼示例
-
創建 maven 項目,以此項目為父項目,在父項目的 pom.xml 中導入相關依賴
<dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.1.9.RELEASE</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.2</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency> </dependencies>
-
-
在父項目上右鍵創建子項目,創建完成之后,在子項目上右鍵選中 Add framework support 找到 Web Application 勾選上
-
具體步驟
-
勾選完之后項目會出現 web 目錄
-