Explanation on the use and modification of Tomcat's default program publishing path

Explanation on the use and modification of Tomcat's default program publishing path

The default program publishing path of tomcat7 is tomcat/webapps/ROOT/.

example

For example, if I create a jsp file in the tomcat/webapps/ROOT/ path, I can directly use the URL:

http://localhost:8080/index.jsp

Come visit.

For example, when I do file upload and download functions, I can create a new FileUpload folder under ROOT, set the path of the uploaded file to this folder, and then upload a file test.txt; when doing the download function, click the download button of the file to directly open a URL on the web page:

http://localhost:8080/FileUpload/test.txt

Revise

Open tomcat/conf/server.xml, there is the following code:

   <Host name="localhost" appBase="webapps"
      unpackWARs="true" autoDeploy="true">
    <!-- 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
       Note: The pattern used is equivalent to using pattern="common" -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
        prefix="localhost_access_log." suffix=".txt"
        pattern="%h %l %u %t &quot;%r&quot; %s %b" />
   </Host>

name is the local access address and appBase is the parent address of the project, both of which can be modified. Add the following tags between the host tags

<Context path="" docBase="example" debug="0" reloadable="true" />

Among them, path is the name of the virtual directory. As long as you enter the IP address, the homepage will be displayed. docBase is the path of the virtual directory. The default is tomcat/webapps/ROOT/. We change it to docBase="example". At this time, example has the same function as ROOT!

mission success

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Analysis and solution of abnormal problem of loading jar in tomcat
  • Detailed understanding and comparative analysis of servers Apache, Tomcat and Nginx
  • Explanation of several ways to run Tomcat under Linux
  • How to set up virtual directories and configure virtual paths in Tomcat 7.0
  • Explanation of Tomcat using IDEA remote Debug
  • Tomcat uses Log4j to output catalina.out log
  • Connector configuration in Tomcat
  • Detailed steps for importing eclipse projects into IDEA and deploying them to tomcat
  • Detailed explanation of how to solve the conflict of project URLs caused by setting the default path of Tomcat
  • Solution to Tomcat server failing to open tomcat7w.exe

<<:  Detailed summary of MySQL and connection-related timeouts

>>:  CocosCreator Universal Framework Design Network

Recommend

Detailed explanation of three ways to connect Docker containers to each other

There are three ways to interconnect and communic...

Basic ideas and codes for implementing video players in browsers

Table of contents Preface Summary of audio and vi...

Solution to VMware virtual machine no network

Table of contents 1. Problem Description 2. Probl...

Detailed explanation of custom instructions for Vue.js source code analysis

Preface In addition to the default built-in direc...

Steps to package and release the Vue project

Table of contents 1. Transition from development ...

Detailed explanation of mysql5.6 master-slave setup and asynchronous issues

Table of contents 1. MySQL master-slave replicati...

Advantages of MySQL covering indexes

A common suggestion is to create indexes for WHER...

MySQL DML language operation example

Additional explanation, foreign keys: Do not use ...

In-depth explanation of the locking mechanism in MySQL InnoDB

Written in front A database is essentially a shar...

A brief discussion on the use and analysis of nofollow tags

Controversy over nofollow There was a dispute bet...

How to solve the problem of ERROR 2003 (HY000) when starting mysql

1. Problem Description When starting MYSQL, a pro...

How to uninstall MySQL 5.7.19 under Linux

1. Find out whether MySQL was installed before Co...

How to set up FTP server in CentOS7

FTP is mainly used for file transfer, and is gene...