web应用和虚拟目录的映射

来源:互联网 发布:来个淘宝买水果靠谱的 编辑:程序博客网 时间:2024/06/06 23:51
web应用和虚拟目录的映射
   在D:\apache-tomcat-6.0.14\conf的server.xml文件中配置
   在<Host></Host>之间加上
    <Context path="/xunimulu" doBase="c:\news"/>
    其中xunimulu可以随便取名字,为虚拟目录,doBase是真实的目录
    在浏览器中输入
    http://localhost:8080/xunimulu/1.html
    (真实项目中一般不用上面那种方法,因为每次修改都要重启)
   
   另一种方法,这里面有介绍:
 file:///D:/apache-tomcat-6.0.14/webapps/docs/config/context.html
 
 Context elements may be explicitly defined:


in the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps
in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host
in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml.
if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files
inside a Host element in the main conf/server.xml




直接把文件放在D:\apache-tomcat-6.0.14\webapps中
0 0
原创粉丝点击