Suppose hello. the JSP access path is: http: // 127.0.0.1: 8080/bookstore/hello. JSP, and when we access the Internet, usually only need to write a domain name or IP address can be, such as http://www.google.com, www.google.com is a domain name, need to buy at the domain name management center, then, the domain name and IP address are associated. So the http://www.google.com is equivalent to http: // 127.0.0.1. Next we will introduce how to configure to avoid writing other parts (8080/bookstore/Hello. jsp ).
Configure port8080 is the port occupied by the application. If the port is 80, it can be left empty. The port must be configured in server. XML (in the conf folder of the tomcat installation directory. In server. find the following code in XML: <connector Port = "8080" protocol = "HTTP/1.1" maxthreads = "150" connectiontimeout = "20000" redirectport = "8443"/> change 8080 in the code to 80. Note: After modification, You need to restart the server.
Configure ApplicationThe configuration application is also carried out in server. xml. In server. find the following code in XML: Configuration welcome FileIf you do not enter a file name when accessing the application, the system accesses the welcome file. the configuration in XML allows you to define multiple welcome files. The system will search for the welcome files in order, and the system will display the files if they exist. Add the following code before </Web-app>. <Welcome-file-List> <welcome-File> index.html </welcome-File> <welcome-File> index.htm </welcome-File> <welcome-File> index. in the JSP </welcome-File> </welcome-file-List> example, 3 Welcome files index.html?index.htm and index are set. JSP to display the file that exists when accessing the application. Last Lecture:
Lecture 8: Java Web Development HistoryNext Lecture:
Java Web basics: Overview of Web application InputLi xucheng csdn blog: Why? U= 124362 & C = 7be8ba2b6f3b6cc5