标签:style blog http io color ar sp java strong
1、新建maven project 注意:勾上create a new simple project
2、填写相关信息, Grounp id为大项目名字,Artifact id为小项目的名字。注意:Packaging选war
3、点击项目---->鼠标右键---->properties---->project facets---->将java选项的1.5改成你需要的jdk版本(我的是1.7)---->去掉Dynamic Web Module选项----->apply----->OK---->再到properties---->project facets---->选上Dynamic Web Module选项----->apply----->OK
4、在webContent下新建index.jsp,建完之后会报错的,是因为servlet包没有加进去
5、更新pom.xml的内容,在pom.xml的project中加入基本的配置
<dependencies> <!-- JUnit配置 --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- servlet配置 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>3.0-alpha-1</version> </dependency> <!-- Spring配置 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.1.2.RELEASE</version> </dependency> <!-- 添加slf4j的支持 --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.7</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.7</version> </dependency> <!-- 添加log4j的支持 --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> </dependencies>
6、修改inde.jsp的内容。在body区域加入
<h2>helloworld</h2>
7、在项目上右击---->run as ---->run on server(tomcat服务器选择自己所用的版本即可)
标签:style blog http io color ar sp java strong
原文地址:http://www.cnblogs.com/JAYIT/p/4099945.html