IDEA设置tomcat及部署web项目

前提条件:

1.Windows下安装好tomcat

2.Windows下安装好IDEA

 

步骤:

给IDEA工程添加tomcat

打开IDEA工程,File-->Settings-->搜索找到Application Servers-->点击“+”

IDEA设置tomcat及部署web项目

IDEA设置tomcat及部署web项目

选择tomcat的安装目录,点击OK 

IDEA设置tomcat及部署web项目

IDEA设置tomcat及部署web项目

添加新的模块

右键工程目录-->New-->Module

IDEA设置tomcat及部署web项目

 

IDEA设置tomcat及部署web项目

 

IDEA设置tomcat及部署web项目

新模块aa目录结构如下:

IDEA设置tomcat及部署web项目

IDEA设置tomcat及部署web项目

 

部署web项目到tomcat运行

 

运行配置:Run-->Edit Configurations

IDEA设置tomcat及部署web项目 

点击“+”添加

IDEA设置tomcat及部署web项目

找到Tomcat Server-->Local

IDEA设置tomcat及部署web项目

修改Name-->修改运行使用的浏览器-->修改URL

IDEA设置tomcat及部署web项目

点击Deployment-->点击右侧“+”号-->Artifact

IDEA设置tomcat及部署web项目

选择要不上的Artifacts,这里选择aa:war exploded-->点击OK

IDEA设置tomcat及部署web项目

修改Application context,这里改为/aa, 访问路径为 localhost:8080/aa

如果改为/bb,访问路径为 localhost:8080/bbIDEA设置tomcat及部署web项目

点击运行

IDEA设置tomcat及部署web项目

浏览器访问:http://localhost:8080/aa/

IDEA设置tomcat及部署web项目

因为可以修改index.jsp的内容,

IDEA设置tomcat及部署web项目

重新部署

IDEA设置tomcat及部署web项目

再次访问

IDEA设置tomcat及部署web项目

 

 

完成! enjoy it!