Tomcat默认打开项目设置

Tomcat设置默认启动项目

Tomcat设置默认启动项目,顾名思义,就是让可以在浏览器的地址栏中输入ip:8080,就能访问到我们的项目。具体操作如下:

1、打开tomcat的安装根目录,找到Tomcat 6.0\conf\server.xml,打开该文件,找到<Host>节点,在该节点中添加<Context path="" docBase="../WebTest" debug="0" reloadable="true"/>。

2、再将WebTest工程放到tomcat根目录下,并将webapps文件夹中的ROOT文件夹删除或者重命名为另外一个名字。

3、启动tomcat,在浏览器中输入ip:8080,就可以访问到你的项目了。

注意:<Context>节点中的docBase属性的值是指向web工程的绝对路径。

Web工程设置默认启动页面

Java web工程设置默认启动页面是通过web.xml文件来配置的。具体配置如下:

<servlet>

<servlet-name>StartServlet</servlet-name>

<servlet-class>NVMP.VideoServer.implement.StartServlet</servlet-class>

<load-on-startup>0</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>StartServlet</servlet-name>

<url-pattern>/StartServlet</url-pattern>

</servlet-mapping>

<welcome-file-list>

<welcome-file>login.jsp</welcome-file>

</welcome-file-list>

找到Tomcat的安装路径,打开conf文件夹中的server.xml文件:加入

以下代码,为红色代码部分

<Context path="" debug="0" docBase="E:\javasoft\Tomcat 6.0(Tomcat 7.0)\webapps\默认打开你的项目名" />
修改后的server.xml文件为下面所示,经测试,6.0和7.0都没问题的。

<?xml version=‘1.0‘ encoding=‘utf-8‘?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->

    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->       

      <!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->
  <Context path="" debug="0" docBase="E:\javasoft\Tomcat 6.0(Tomcat 7.0)\webapps\默认打开你的项目名" />
      </Host>
    </Engine>
  </Service>
</Server>
时间: 2024-10-23 14:48:48

Tomcat默认打开项目设置的相关文章

【MyEclipse】JSP默认打开方式 设置(双击)

下图为MyEclipse8.5设置界面,通过window->Preferences打开,并在General选项下选择 Editors->File Associations ,然后选择要设置的文件格式,选择需要的打开方式,设置为默认打开方式.

tomcat默认启动项目修改

tomcat中怎么设置自己的项目为默认项目? 方法一:将项目拷贝到webapps下,并将项目名称改为ROOT: 方法二:设置虚拟路径.修改tomcat/conf/server.xml的Context配置项<Context path="" debug="0" docBase="项目的相对webapps的路径(也可以使用绝对路径)" reloadable="true"></Context>.(放到host中

更改Tomcat默认目录+端口+设置缺省网页的方法

我在$tomcat/webapps/下建了个myjsp目录作为我网站的默认目录,在myjsp中有一个a.jsp文件,该文件要作为我网站的默认主页.   修改配置文件:   首先,修改$tomcat/conf/server.xml文件. 在server.xml文件中,有一段如下: --  <engine name="Catalina" defaultHost="localhost">    <host name="localhost&quo

Intelij idea新窗口打开项目设置

1.idea 打开后 file->setting   2.appearance&behave->system setting->open project in new window 点击APPLY

给程序添加默认打开方式 不成功

昨天装了sublime2后把一些文本文件默认打开方式设置为sublime2,然后又装了一个sublime3,把sublime2给卸载了. 接下来那些被设置过打开方式的文件,打开的时候就出错了.然后试图将sublime3设置为默认打开方式,这时怎么设置都设不上, 重启电脑还是不行,后来发现注册表里 HKEY_CLASSES_ROOT\Applications\sublime_txt.exe\shell\open\command 是这样的 "E:\Program Files\Sublime Text

(原创)项目部署-Tomcat设置默认访问项目及项目重复加载问题处理

主要是通过配置<Tomcat安装目录>/conf/server.xml文件 步骤: 1.打开server.xml,在</Host>的上一行添加内容格式如下 <Context path="" reloadable="true" docBase="<项目名>"/> 如: <Host name="www.abc.com" appBase="webapps" u

Tomcat设置默认启动项目及Java Web工程设置默认启动页面

Tomcat设置默认启动项目 Tomcat设置默认启动项目,顾名思义,就是让可以在浏览器的地址栏中输入ip:8080,就能访问到我们的项目.具体操作如下: 1.打开tomcat的安装根目录,找到Tomcat 6.0\conf\server.xml,打开该文件,找到<Host>节点,在该节点中添加<Context path="" docBase="../webapps/WebTest" debug="0" reloadable=&

VS2010 项目属性的默认包含路径设置方法

VS2010 项目属性的默认包含路径设置方法 分类: c++小技巧2014-01-10 10:16 1358人阅读 评论(0) 收藏 举报 c++ 有两种方法可以设置vs2010的默认包含路径 方法一: 点击“视图->属性管理器”,在打开的属性管理器中选择Microsoft.Cpp.Win32.user打开 打开后将出现如下图所示: 这时候就可以设置默认目录了. 方法二: 打开 C:\Users\Administrator\AppData\Local\Microsoft\MSBuild\v4.0

Tomcat 默认项目配置

Tomcat 默认项目设置 1.删除ROOT下文件,将项目解压后的文件放到ROOT文件下面 修改 Server.xml 如下: <Host name="localhost" appBase="webapp" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">