博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java web 项目打包(war 包)并部署
阅读量:4205 次
发布时间:2019-05-26

本文共 745 字,大约阅读时间需要 2 分钟。

1、在eclipse中右键单击项目,然后Export选择WAR file,生成项目的WAR文件。具体步骤请看图片详细操作步骤:

2、把生成的WAR文件放到tomcat解压之后的webapps文件夹下。

 

3、在tomcat的conf文件夹里的server.xml进行配置:

      在<Host></Host>标签之间添加如下代码:

       <Context path="/" docBase="F:/tomcat/webapps" debug="0" reloadable="true" crossContext="true"> </Context>

或者

  <Context docBase="D:\pafalearning\userapp\dist\tomcat\userapp.war" path="/userapp" reloadable="true"/>

 docBase:指向项目的根目录所在的路径,由于我将项目打成了war包,所以直接指向这个war包就可以了(我的项目名为:userapp). 

path:是一个虚拟目录,这里设置成了"userapp",则启动Tomcat后,你将通过http://localhost:8080/userapp/*.jsp来访问项目的相关页面. 
reloadable:如果设置为"true",则表示当你修改jsp文件后,不需要重启服务器就可以实现页面显示的同步. 
可以这样理解:将docBase实际目录下的项目,映射到${tomcat.home}\webapps目录下的虚拟项目path(这里的配置指的是userapp项目).

4、启动tomcat。双击tomcat解压文件里bin目录下的startup.bat。

5、在浏览器中输入相应地址即可。

原网页地址:

转载地址:http://igxli.baihongyu.com/

你可能感兴趣的文章
【IOS游戏开发】之IPA破解原理
查看>>
【一天一道LeetCode】#45. Jump Game II
查看>>
【一天一道LeetCode】#46. Permutations
查看>>
【一天一道LeetCode】#47. Permutations II
查看>>
【一天一道LeetCode】#48. Rotate Image
查看>>
【一天一道LeetCode】#56. Merge Intervals
查看>>
【一天一道LeetCode】#57. Insert Interval
查看>>
【一天一道LeetCode】#58. Length of Last Word
查看>>
【一天一道LeetCode】#59. Spiral Matrix II
查看>>
【一天一道LeetCode】#30. Substring with Concatenation of All Words
查看>>
【一天一道LeetCode】#60. Permutation Sequence.
查看>>
【一天一道LeetCode】#62. Unique Paths
查看>>
【一天一道LeetCode】#61. Rotate List
查看>>
【一天一道LeetCode】#63. Unique Paths II
查看>>
【一天一道LeetCode】#36. Valid Sudoku
查看>>
【一天一道LeetCode】#75. Sort Colors
查看>>
【一天一道LeetCode】#76. Minimum Window Substring
查看>>
【计算机网络 第五版】阅读笔记之一:概述
查看>>
【计算机网络 第五版】阅读笔记之二:物理层
查看>>
【一天一道LeetCode】#83. Remove Duplicates from Sorted List
查看>>