A jsp (first choice for SUN Enterprise Applications) learning process for beginners (2)
TheUnforgiven
Chapter 2 mild access to server. xml (standardization is getting closer and closer)
Now we are writing our first. jsp (the first choice for SUN Enterprise Applications) file. The Code is as follows:
----------------------------------------------------------------------------------
<% @ Page contentType = "text/html; charset = gb2312" language = "java" errorPage = "" %>
<%
Out. print ("the Japanese should be completely wiped out ");
%>
----------------------------------------------------------------------------------
This file outputs a sentence on the page. You can even write it in notepad, but the main problem is that this file (such as test. where is jsp (the preferred choice for SUN Enterprise Applications. The default directory of tomcat (a very useful JSP running platform) is D: omcat (a very useful JSP running platform) 5.0 webbench JSP (preferred for SUN Enterprise Applications)-examples, in earlier versions of 4.1, the directory is examples. Put this file under jsp (preferred for SUN Enterprise Applications)-examples, enable tomcat (a very useful JSP running platform) server, and enter in the address bar: http: // ringz: 8080/jsp (preferred for SUN Enterprise Applications)-examples/test. jsp (preferred for SUN Enterprise applications ).
Now I want to talk about the problem: I don't want to use port 8080. I just use http: // ringz/jsp (preferred for SUN Enterprise Applications)-examples/test. how nice is jsp (the preferred choice for SUN Enterprise applications. This depends on whether your port 80 is occupied. Generally, your machine does not install IIS or stop the IIS service, and port 80 can be used. The specific modification method is as follows: Open this file -- D: omcat (a very useful JSP running platform) 5.0confserver.xml (standardization is getting closer and closer), you will find this piece of code:
<Connection port = "8080"
MaxThreads = "150" minSpareThreads = "25" maxSpareThreads = "75"
EnableLookups = "false" redirectPort = "8443" acceptCount = "100"
Debug = "0" connectionTimeout = "20000"
DisableUploadTimeout = "true"/>
Change port = "8080" to port = "80", save the file, and restart tomcat (a very useful JSP operating platform) server. If the server can be started, port 80 can be used; if the startup window of tomcat (a very useful JSP running platform) is closed in a flash, port 80 is occupied (the premise of this judgment is that the server. there are no errors in xml (standardization is getting closer and closer) files. If there are other errors, such as missing "/>", it will also be like this ). By using this method, you can change to another idle port. For example, the company that gives us software uses port 7988 during testing. Except port 80, other ports must be specified in the address bar. Port 80 is not used because it is the default port of http.
The following question is: I don't want to write it. jsp (preferred for SUN enterprise-level applications) files are stored in D: omcat (a very useful JSP running platform) 5.0 webbench jsp (preferred for SUN enterprise-level applications)-What to do under examples? You also need to modify the server. xml (standardization is getting closer and closer) file: assume that your. jsp (preferred for SUN Enterprise Applications) files are all placed under e: Myjsp (preferred for SUN Enterprise applications, add the following code between the <Host> </Host> file: <Context path = "/Myjsp (preferred for SUN Enterprise Applications)" docBase = "e: myjsp (the preferred choice for SUN Enterprise Applications) "debug =" 0 "reloadable =" true "crossContext =" true "/> (note that it must be the same case as the file name ). In this way, you can enter http: // ringz/Myjsp (preferred for SUN Enterprise Applications)/test. jsp (the preferred choice for SUN Enterprise Applications) (the same case must be the same) to run this file. If changed to: <Context path = "" docBase = "e: Myjsp (preferred for SUN Enterprise applications) "debug =" 0 "reloadable =" true "crossContext =" true "/>, enter http: // ringz/test in the address bar. jsp (the preferred choice for SUN Enterprise applications.
If you are interested, you can see what the page looks like after entering http: // ringz only.
Now you may have this idea: I have a system (such as login.htm) with a fixed access file (such as login.htm). I want to open this file only by entering http: // ringz in the address bar. What should I do? This can be modified through the server. xml (standardization is getting closer and closer) web in the same directory. xml (standardization is getting closer and closer) file implementation: generally there is such a code at the bottom of this file: