国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - Java教程 - springmvc+maven搭建web項目

springmvc+maven搭建web項目

2020-12-09 14:01李悠然 Java教程

這篇文章主要為大家詳細介紹了springmvc+maven搭建web項目的相關資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了springmvc maven搭建web項目的具體步驟,供大家參考,具體內容如下

1、創建一個maven project 為spring1

2、進行項目的配置:默認的java 1.5 在properties中選擇project facts項目進行配置,反選web之后修改java環境為1.8.修改之后如下圖:

springmvc+maven搭建web項目

3. 配置好的工作目錄如下:

springmvc+maven搭建web項目

4 修改pom.xml文件

增加兩個jar包:servlet和spring webmvc

pom.xml如下:

 
?
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!doctype web-app public
"-//sun microsystems, inc.//dtd web application 2.3//en"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
 
<web-app>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>
</servlet>
 
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

4. 默認的配置文件是spring-servlet.xml ,在/web-inf下創建配置文件,內容如下:

 
?
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemalocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
 
<!-- 配置掃描的包 -->
<context:component-scan base-package="spring1.*" />
 
<!-- 注冊handlermapper、handleradapter兩個映射類 -->
<mvc:annotation-driven />
 
<!-- 訪問靜態資源 -->
<mvc:default-servlet-handler />
 
<!-- 視圖解析器 -->
<bean
>
<property name="prefix" value="/web-inf/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
 
</beans>

注:在這個默認的配置過程中 程序會掃描spring1包中的所有的controller

5、 在src/main/java創建controller

 
?
1
 
2
3
4
5
6
7
8
9
10
11
12
13
package spring1;
 
import org.springframework.stereotype.controller;
import org.springframework.web.bind.annotation.requestmapping;
 
@controller
public class democontroller {
 
@requestmapping("/index")
public string index(){
return "index";
}
}

6、 在webapp目錄下創建index.jsp.

 
?
1
 
2
3
4
5
<html>
<body>
<h2>hello world!</h2>
</body>
</html>

7、 部署項目到tomcat上,部署的內容如下:

springmvc+maven搭建web項目

8、啟動tomcat 在瀏覽器中輸入:http://localhost:8080/spring1/

springmvc+maven搭建web項目

總結:調試了好久,終于調試出來信息啦 小小激動一下啊

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 精品久久久久久久久久 | 亚洲一区二区三区精品动漫 | 日韩电影在线 | 国产精品乱码人人做人人爱 | 国产日韩视频 | 婷婷成人av| 91成人免费在线观看 | 精品亚洲一区二区三区四区五区 | 久久国产一区 | 亚洲综合精品 | 亚洲 欧美 日韩在线 | 亚洲一区 中文字幕 | 国产精品不卡一区 | 国产精品自拍在线观看 | 日韩一区不卡 | 俺去俺来也在线www色官网 | 女人久久久 | 久久久一区二区 | 成人免费视频网址 | 精品在线二区 | 国产精品亚洲第一区在线暖暖韩国 | 岛国av在线免费观看 | 国产精品成人一区二区三区 | 福利黄色| 天天操天天操 | 久久亚洲一区 | 国产成人高清在线 | 国产成人免费视频网站高清观看视频 | 精品在线一区二区 | 欧美精品欧美精品系列 | 黄色片视频在线观看 | 欧美久久综合 | 日本免费在线视频 | 中文字幕精品一区二区精品 | 一性一交一色生活片 | 精品久久一区二区三区 | 日韩免费一区 | 国产午夜精品一区二区三区视频 | 天天草天天干 | av影音 | 免费av一区|