本文共 745 字,大约阅读时间需要 2 分钟。
在<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项目).原网页地址:
转载地址:http://igxli.baihongyu.com/