JAVA_WEB03 Publishing based on virtual path

Source: Internet
Author: User

Tag: Fail is occupied by the game inf false HTM based on add code

1. For example, the virtual path of the file is D:/games/halo/firstweb.

2. Open conf in Tomcat, open Server.xml, find connector line, port refers to port number, default is 8080, can be modified

3. Find the host row and add the code to the host:

<context path= "(Take a name, try to remember, when you enter the URL to replace the virtual path, here with/haha instead)/haha"

Docbase= "D:/games/halo/firstweb. (to Web-inf level) "

Reloadable= "true (True or false,true refers to a change in the Java file that can be automatically reloaded without restarting the server)"/>

4. (already open Tomcat) at this point in the browser, enter the URL localhost:8080/haha/(above our own name), we can access our Index.xml Web page. But we don't have a definite input index.xml.

5. The reason here, in Tomcat in Conf, is another file in Web. XML, open it, and find three (or several) parameters in the <welcome file-list>:

<welcome file> index.html<welcome file/>

<welcome file> index.htm<welcome file/>

<welcome file> index.jsp<welcome file/>

The first parameter <welcome file> index.xml<welcome file/> here <welcome file> and <welcome file/> Clip in the middle refers to the default access to the page, above our localhost:8080/hello/effect and localhost:8080/hello/index.html the same, the rest of the similar.

6. If you want to add a new default access page, you can add code after the original <welcome file> index.jsp<welcome file/>:

<welcome file> (the name of your file, here with Newweb instead) Newweb<welcome File/>, of course, the file here is better already exist, otherwise the access will only be 404 error, Newweb is stored in d:/ Games/halo/firstweb under the

7. (This is a very dangerous operation) in the process of development, too many files, want to find files in the Web site, you can modify the Conf in Tomcat in the Web. xml file in the <servlet> <param-value> False to True, you can search for URLs in other folders when you enter the wrong URL

Small record: {

1. The default port number for all sites is 80.

2. After modifying the port, start Tomcat actually error socket bind failed refers to the port is already occupied, by Netstat-na to see the port usage of the computer

3.localhost is actually a class

The information in the 4.web-inf folder is not available on the website and is automatically hidden.

}

JAVA_WEB03 Publishing based on virtual path

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.