tomcat下有9个目录,分别是bin,common,conf,logs,server,shared,temp,webapps,work<wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">目录,现在对每一目录做介绍.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">tomcat根目录在tomcat中叫<CATALINA_HOME>,文章中把tomcat解压后在c:/下.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">1.<CATALINA_HOME>/bin:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">存放各种平台下启动和关闭Tomcat的脚本文件.其中有个档是catalina.bat,打开这个windos配置文件,在非注释行加入JDK路径,例如</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">SET</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">JAVA_HOME=C:\j2sdk1.4.2_06</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">保存后,就配置好tomcat环境了.</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">startup.bat是windows下启动tomcat的文件,shutdown.bat是关闭tomcat的文件.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">2.<CATALINA_HOME>/common:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">在common目录下的lib目录,存放Tomcat服务器和所有web应用都能访问的JAR?.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">3.<CATALINA_HOME>/shared:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">在shared目录下的lib目录,存放所有web应用能访问的,但Tomcat不能访问的JAR?.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">4.<CATALINA_HOME>/server:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">在server/webapps目录中,存放Tomcat自带的两个APP-admin和manager应用,使用来管理Tomcat-web服务用的.在server/lib目录中,存放tomcat服务器所需要的各,web应用不能访问种jar?.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">5.<CATALINA_HOME>/work</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Tomcat把各种由jsp生成的servlet文件放在这个目录下.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">6.<CATALINA_HOME>/temp</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">临时活页夹,Tomcat运行时候存放临时文件用的.</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">7.<CATALINA_HOME>/logs</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">存放Tomcat的日志文件</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">8.<CATALINA_HOME>/conf</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Tomcat的各种配置文件,最重要的是</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">server.xml;配置tomcat组件的XML文件server.XML其中包括</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">I.顶层类元素[Top</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Level</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Elements]:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">位于整个配置文件的顶层,</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">包括<Server>和<Service>;</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">II.连接器类元素[Connectors</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">]:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">客户和服务(容器类元素)间的通讯接口.接受客户请求,返回响应结果;<Connector></span><wbr style="line-height:21px; color:rgb(70,70,70)"><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">II.容器类元素[Containers]:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">处理客户请求并且生成响应结果,包含3个:<Engine></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"><Host></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"><Context></span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">IV.嵌套类元素[Nested</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Components]:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">可以加入到容器中的元素,包括:<logger></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"><Valve><Realm>等</span><br style="line-height:21px; color:rgb(70,70,70)"><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">一个<Server>包含一个或多个<Service>,一个<Service>包含唯一一个<Engine>和一个或多个<Connector>,多个</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"><Connector>共享一个<Engine>;一个<Engine>包含多个<Host>,每个<Host>定义一个虚拟主机,包含一个或多个web应用<Context>;</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"><Context>元素是代表一个在虚拟主机上运行的Web应用.<Context>标签的描述</span><br style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Please</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">note</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">that</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">for</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">tomcat</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">5.x,</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">unlike</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">tomcat</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">4.x,</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">it</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">is</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">NOT</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">recommended</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">to</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">place</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"><Context></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">elements</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">directly</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">in</span><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">the</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">server.xml</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">file.</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">Instead,</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">put</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">them</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">in</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">the</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">META-INF/context.xml</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">directory</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">of</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">your</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">WAR</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">file</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">or</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">the</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">conf</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">directory</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">as</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">described</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">above.</span><wbr style="line-height:21px; color:rgb(70,70,70)"><br style="line-height:21px; color:rgb(70,70,70)"></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)"></span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">9.<CATALINA_HOME>/webapps:</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">web应用的发布目录,把</span><wbr style="line-height:21px; color:rgb(70,70,70)"><span style="line-height:21px; color:rgb(70,70,70)">java开发的web站点或war文件放入这个目录下就可以通过tomcat服务器访问了.</span></wbr></wbr></wbr></wbr></wbr></wbr>
转至:点击打开链接