在pom.xml中加入如下配置:
<build>
<finalName>showtime-manager-web</finalName>
<plugins>
<!-- 配置Tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<!--配置为/当访问localhost时不需要再加8081-->
<path>/</path>
<port>8081</port>
</configuration>
</plugin>
</plugins>
</build>
选择Edit Configuration
接着点击左上角的+,选择maven
输入相关信息,点击Apply之后,点击OK
效果如图:
在web.xml文件中加入以下内容:
<web-app>
<display-name>showtime-manager-web</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
点击途中三角形的图标启动项目
访问效果如下图: