Modify the Tomcat welcome page to the homepage of your project

Source: Internet
Author: User

1. I built a myjsp directory under $tomcat/webapps/as the default directory for my site, and in myjsp there is a a.jsp file that is the default home page for my site.

2. Modify the configuration file:
First, modify the $tomcat/conf/server.xml file.
in the Server.xml file, there is a section as follows:
...
<engine name= "Catalina" defaulthost= "localhost" >
  
      unpackwars= "true"
      xmlvalidation= "false" Xmlnamespaceaware= "false" >
  ...
  
</engine>
...
3. Add between
<context path= "" docbase= "myjsp" debug= "0" reloadable= "true"/>

Path is the name of the virtual directory, if you want to enter only the IP address to display the home page, the key value is left blank;

Docbase is the path to the virtual directory, it defaults to the $tomcat/webapps/root directory, and now I have a myjsp directory under the WebApps directory, which is the default directory for my directory.

Debug and reloadable are generally set to 0 and true respectively.

4. Then, modify the $tomcat/conf/web.xml file.
in the Web. xml file, there is a section as follows: <welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file></welcome-file-list>add between <welcome-file-list> and <welcome-file>index.html</welcome-file>:
<welcome-file>a.jsp</welcome-file>
5. Change the port (this step can be omitted)
<connector port= "8080" maxthreads= "All" minsparethreads= "" maxsparethreads= "" enablelookups= "" false " Redirectport= "8443" acceptcount= "debug=" 0 "connectiontimeout=" 20000 "disableuploadtimeout=" true "/>


change port "8080" to your ports

after saving the two files above, restart Tomcat and enter "http://localhost:8080/" in the browser address bar to display the contents of the a.jsp page.

Modify the Tomcat welcome page to the homepage of your project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.