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>

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

  1. 将个人网站主页设置为Tomcat默认打开页面

    步骤: 1.打开server.xml,在</Host>的上一行添加内容格式如下 <Context path="" reloadable="true&qu ...

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

    下图为MyEclipse8.5设置界面,通过window->Preferences打开,并在General选项下选择 Editors->File Associations ,然后选择要设置 ...

  3. Ubuntu 16.04修复PDF默认使用ImageMagick打开无法设置其它默认的问题(默认打开程序设置)

    打开:~/.config/mimeapps.list 去掉以下几项: image/pdf=display-im6.desktop image/pdf=display-im6.q16.desktop;d ...

  4. Intelij idea新窗口打开项目设置

    1.idea 打开后 file->setting   2.appearance&behave->system setting->open project in new win ...

  5. 浏览器Firefox新标签页默认打开地址设置

    1.地址栏输入about:config 2.找到browser.newtab.url 修改它的值为你想要的地址,如:https://www.baidu.com

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

    主要是通过配置<Tomcat安装目录>/conf/server.xml文件 步骤: 1.打开server.xml,在</Host>的上一行添加内容格式如下 <Contex ...

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

    Tomcat设置默认启动项目 Tomcat设置默认启动项目,顾名思义,就是让可以在浏览器的地址栏中输入ip:8080,就能访问到我们的项目.具体操作如下: 1.打开tomcat的安装根目录,找到Tom ...

  8. Tomcat设置默认启动项目

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

  9. 在.sln文件中设置Visual Studio默认启动项目的简单方法

    昨天在一台电脑上用git新签出一个项目进行build,却出现一堆编译错误,而在原先的开发机上build无任何错误.对比分析后发现,开发机上VS的启动项目(startup project)与这台电脑上的 ...

随机推荐

  1. MFC/VC++ UI界面美化技术

    1.     工具: 1.1设备环境类: Windows下的绘图操作说到底就是DC操作.DC(Device Context设备环境)对象是一个抽象的作图环境,可能是对应屏幕,也可能是对应打印机或其它. ...

  2. oracle知识杂记

    索引类型 1.B-树索引 分区索引.压缩索引.函数索引等都属于B-树索引 2.位图索引 3.索引组织表 索引管理 1.普通单列索引                    对where条件.group ...

  3. PS之放射背景

    效果图 素材 新建图层,填充颜色 新建图层,矩形工具画条形 滤镜-扭曲-极坐标 合并图层,效果如下 新建图层,画一个适当的圆 滤镜-模糊-高斯模糊 将素材人物抠出来放在中间

  4. 对 JDBC 做一个轻量封装,待完善。。。

    对 JDBC 做一个轻量地封装,顺便复习,熟悉sql,io,util,lang.Reflect等包的使用,泛型的使用,待完善... package com.webproj.utils; import ...

  5. font awesome icon

    http://fontawesome.io/icons/ http://www.bootstrapicons.com/

  6. 关于wordpress忘记密码 找回密码的方式

    1.通过直接修改数据库中密码的加密字符(如果wordpress的版本不同,那么此方法是不好实现的) 2.使用找回密码的方式:通过邮箱找回密码 前端登录密码错误后 会显示   错误); 方法二 打开WP ...

  7. WEB系统开发方向

    1. UI框架:要可以结合jquery+自定义服务器控件开发一套UI框架: 2.WEB报表设计器:用js开发一套可以自定义报表设计器: 3.WEB自定义表单+工作流设计器: 4.WEB打印组件: 5. ...

  8. fekit前端代码模块化工具

    fekit是一套前端开发工具,是由去哪儿网开发.目前在github上开源.使用fekit的优点: a.本地开发支持环境:从开发调试到上线,均是前后端工程独立开发.调试.部署,打破了原来前后端揉在一个工 ...

  9. ios后台程序持续运行方法

    iOS系统的资源是有限的,应用程序在前台和在后台的状态是不一样的.在后台时,程序会受到系统的很多限制,这样可以提高电池的使用和用户体验.但是有很多社交类的软件,如果因为它在后台就不能刷新到新的数据的话 ...

  10. DevExpress XtraGrid RepositoryItemCheckEdit 复选框多选的解决方法

    1. RepositoryItemCheckEdit默认有三种状态,选中状态.未选中状态和半选中状态(半选中状态通常用在TreeList中如果父节点下的子节点有选中的有未选中的,则父节点状态为半选中状 ...