<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alex's Blog &#187; tomcat</title>
	<atom:link href="http://www.hialex.net/tags/tomcat/feed" rel="self" type="application/rss+xml" />
	<link>http://www.hialex.net</link>
	<description>记录生活与工作中的点点滴滴</description>
	<lastBuildDate>Sat, 09 Jan 2010 12:37:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tomcat设置</title>
		<link>http://www.hialex.net/2008/01/jsp-note-1.html</link>
		<comments>http://www.hialex.net/2008/01/jsp-note-1.html#comments</comments>
		<pubDate>Thu, 10 Jan 2008 08:34:11 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[虚拟目录]]></category>

		<guid isPermaLink="false">http://www.hialex.net/2008/01/jsp-note-1.html</guid>
		<description><![CDATA[前言：前段时间学习了JAVA，主要是Stardard Edition部分，由于是自学看的不是太仔细只是了解了个大概，趁现在放假在家空余时间比较多所以想继续学下去，但是JAVA的知识体系实在是太庞大，所以只能一步一步来，所以这个寒假的主要任务就是学习下JSP，顺带巩固JAVA基础部分。由于自己看书实在是太枯燥了，所以我就在电驴上找了JSP的视频教程跟着学然后再照着练练巩固下，每天看两集，第二天写下学习笔记，这样希望能把前一天学的记住。
言归正传&#8230;&#8230;（我装的是Tomcat 6.0.14版本）
Tomacat是一个WEB容器，所有的J2EE WEB程序可以在此处运行。常见的WEB容器还有WebLogic、WebSphere。
Tomcat的默认端口号是8080，这个数值可以在安装过程中修改也可以在conf/server.xml中修改。
Tomcat是根据系统的%JAVA_HOME%变量值选择系统中的JDK。
Tomcat目录主要文件夹作用

bin目录：存放启动和关闭Tomcat的脚本 
conf目录：存放不同配置文件，其中比较重要的是server.xml（Tomcat的主要配置文件）和web.xml 
work目录：存放JSP编译后的.class文件 
webapps目录：存放WEB应用程序 
lib目录：存放所有需要的各种jar包 

配置Tomcat方式有两种：手工配置&#8211;修改conf/server.xml文件、管理控制台配置

注意：修改server.xml之后要重新启动Tomcat服务器才能使配置生效 

配置虚拟目录的要求
 

修改server.xml文件 
虚拟目录的结构要符合要求

WebRoot

WEB-INF

web.xml 




其中web.xml的内容一般为： &#60;coolcode lang=&#34;xml&#34;&#62;&#60;?xml version=&#34;1.0&#34; encoding=&#34;ISO-8859-1&#34;?&#62;          &#60;!&#8211;           Licensed to the Apache Software Foundation (ASF) under one or more        [...]]]></description>
			<content:encoded><![CDATA[<p><strong>前言：</strong>前段时间学习了JAVA，主要是Stardard Edition部分，由于是自学看的不是太仔细只是了解了个大概，趁现在放假在家空余时间比较多所以想继续学下去，但是JAVA的知识体系实在是太庞大，所以只能一步一步来，所以这个寒假的主要任务就是学习下JSP，顺带巩固JAVA基础部分。由于自己看书实在是太枯燥了，所以我就在电驴上找了JSP的视频教程跟着学然后再照着练练巩固下，每天看两集，第二天写下学习笔记，这样希望能把前一天学的记住。</p>
<p>言归正传&#8230;&#8230;（我装的是Tomcat 6.0.14版本）</p>
<p>Tomacat是一个WEB容器，所有的J2EE WEB程序可以在此处运行。常见的WEB容器还有WebLogic、WebSphere。</p>
<p>Tomcat的默认端口号是8080，这个数值可以在安装过程中修改也可以在conf/server.xml中修改。</p>
<p>Tomcat是根据系统的%JAVA_HOME%变量值选择系统中的JDK。</p>
<p>Tomcat目录主要文件夹作用</p>
<ul>
<li>bin目录：存放启动和关闭Tomcat的脚本 </li>
<li>conf目录：存放不同配置文件，其中比较重要的是server.xml（Tomcat的主要配置文件）和web.xml </li>
<li>work目录：存放JSP编译后的.class文件 </li>
<li>webapps目录：存放WEB应用程序 </li>
<li>lib目录：存放所有需要的各种jar包 </li>
</ul>
<p>配置Tomcat方式有两种：手工配置&#8211;修改conf/server.xml文件、管理控制台配置</p>
<ul>
<li>注意：修改server.xml之后要重新启动Tomcat服务器才能使配置生效 </li>
</ul>
<p>配置虚拟目录的要求</p>
<p> <span id="more-48"></span>
<ul>
<li>修改server.xml文件 </li>
<li>虚拟目录的结构要符合要求
<ul>
<li><strong>WebRoot</strong>
<ul>
<li><strong>WEB-INF</strong>
<ul>
<li><strong>web.xml</strong> </li>
</ul>
</li>
</ul>
</li>
<li>其中web.xml的内容一般为： &lt;coolcode lang=&quot;xml&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;          <br />&lt;!&#8211;           <br />Licensed to the Apache Software Foundation (ASF) under one or more           <br />&#160;&#160; contributor license agreements.&#160;&#160; See the NOTICE file distributed with           <br />&#160;&#160; this work for additional information regarding copyright ownership.           <br />&#160;&#160; The ASF licenses this file to You under the Apache License, Version 2.0           <br />&#160;&#160; (the &quot;License&quot;); you may not use this file except in compliance with           <br />&#160;&#160; the License.&#160;&#160; You may obtain a copy of the License at
<p><a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></p>
<p>&#160;&#160; Unless required by applicable law or agreed to in writing, software            <br />&#160;&#160; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,             <br />&#160;&#160; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.             <br />&#160;&#160; See the License for the specific language governing permissions and             <br />&#160;&#160; limitations under the License.             <br />&#8211;&gt; </p>
<p>&lt;web-app xmlns=&quot;<a href="http://java.sun.com/xml/ns/j2ee" ?="?">http://java.sun.com/xml/ns/j2ee&quot;</a>             <br />&#160;&#160;&#160;&#160; xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance" ?="?">http://www.w3.org/2001/XMLSchema-instance&quot;</a>             <br />&#160;&#160;&#160;&#160; xsi:schemaLocation=&quot;<a href="http://java.sun.com/xml/ns/j2ee">http://java.sun.com/xml/ns/j2ee</a> <a href="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" ?="?">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&quot;</a>             <br />&#160;&#160;&#160;&#160; version=&quot;2.4&quot;&gt; </p>
<p>&#160;&#160; &lt;display-name&gt;Welcome to Tomcat&lt;/display-name&gt;            <br />&#160;&#160; &lt;description&gt;             <br />&#160;&#160;&#160;&#160;&#160; Welcome to Tomcat             <br />&#160;&#160; &lt;/description&gt; </p>
<p>&lt;!&#8211; JSPC servlet mappings start &#8211;&gt; </p>
<p>&lt;!&#8211; JSPC servlet mappings end &#8211;&gt; </p>
<p>&lt;/web-app&gt;&lt;/coolcode&gt;</p>
</li>
</ul>
</li>
<li>创建好虚拟目录之后要在server.xml中<strong>&lt;/Host&gt;之前</strong>添加一句<strong>&lt;Context path=&quot;/映射名&quot; docBase=&quot;/本机绝对地址&quot; /&gt;</strong> (大小写敏感，修改完之后应该重新启动Tomcat服务器使配置生效) </li>
</ul>
<p><strong>若设置虚拟目录后访问目录提示404错误而可以运行目录下的jsp文件则说明是目录权限被禁用，可以修改conf/web.xml文件找到&lt;param-name&gt;listings&lt;/param-name&gt;将下面一行中的false改成true</strong></p>
<p>jsp文件的运行过程： <strong>*.jsp&#160; &#8211;&gt;&#160; *.java&#160; &#8211;&gt;&#160; *.class&#160; &#8211;&gt;&#160; 运行显示</strong>&#160; </p>
<ul>
<li>*.class是第一次运行生成后存放在work目录下的，所以jsp文件第一次或者修改后首次运行比较慢而后来再运行的速度很快 </li>
</ul>
<p><a href="http://17fav.com/?url=http%3A%2F%2Fwww.hialex.net%2F2008%2F01%2Fjsp-note-1.html&title=Tomcat%E8%AE%BE%E7%BD%AE" title="用 17fav 收藏和分享本文"><img src="http://17fav.com/i/bookmark.gif" alt="17fav 收藏本文" /></a></p><h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li>2008-04-02 -- <a href="http://www.hialex.net/2008/04/servlet-note.html" title="Servlet程序设计">Servlet程序设计</a> (0)</li><li>2008-03-15 -- <a href="http://www.hialex.net/2008/03/javabean-syntax-b.html" title="JavaBean语法(下)">JavaBean语法(下)</a> (0)</li><li>2008-03-01 -- <a href="http://www.hialex.net/2008/03/usage-of-jdbc.html" title="(九)JDBC操作技术">(九)JDBC操作技术</a> (0)</li><li>2008-03-01 -- <a href="http://www.hialex.net/2008/03/javabean-syntax-a.html" title="JavaBean语法(上)">JavaBean语法(上)</a> (0)</li><li>2008-02-19 -- <a href="http://www.hialex.net/2008/02/jdbc-link-to-mysql.html" title="JDBC连接Mysql数据库">JDBC连接Mysql数据库</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.hialex.net/2008/01/jsp-note-1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
