tomact设置虚拟路径 idea
2017-12-13 本文已影响0人
山顶冻人0
一、在Server.xml中进行配置(单个项目)
在tomact目录下 conf\server.xml
在<Host></Host>标签中间加入<Context path="....." docBase="...."></Context>
path代表虚拟目录 docBase代表绝对路径(真实路径)
reloadable:如果这个属性设为 true,tomcat 服务器在运行状态下会监视在WEB-INF/classes 和 WEB-INF/lib 目录下 class 文件的改动,如果监测到有 class 文件被更新的,服务器会自动重新加载 Web 应用
例如:
<Context path="/images" docBase="d:\images" reloadable="true" debug="0">
</Context>
输入http://localhost:8080/images/a.jpg 就能访问到images下的a图片
重启服务器
在idea 将Deploy applications configured in Tomcat instance勾上

二、多个项目
在tomact目录下 conf\Catalina\localhost下
新建任意名字的.xml文件,在里面写入
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="D:\images" reloadable="true" debug="0"></Context>
不需要重启服务器,只需要在浏览器输入http://loaclhost:8080/images
在idea 将Deploy applications configured in Tomcat instance勾上

三、单个项目在idea里配置tomact虚拟路径


