[Environmental Settings] for Server.xml of Tomcat

xiaoxiao2021-03-06  48

Tomcat Version: 4.1.31 / 5.0.28 Setup Virtual Path: Path: Defined at the address Attached virtual names in the column, for example, after configuring Http://127.0.0.1/example, you can automatically access you E: / Project / Java / lower Project (DocBase is the actual path of the project), he will Automatically look for files named Index, extension .jsp / .htm / .html, etc. is the homepage. If you want to change the Tomcat default directory, you will change the value of the appbase to your actual path.! - Debug = 0 "AppBase =" WebApps "UnpackWars =" true "autodeploy =" true "> This can be accessed directly via http: // localhost or http://127.0.0.1. Setting Server port: change the value of the port to the port you want, 80 is the default The HTTP service port, such as changed to other ports, when access is accessed, add the specified port EXAMPLE: 80 port: http://127.0.0.1/example8080 port: http://127.0.0.1:8080/ Example Sets Web.xml under Project: Many people directly paste the web-infml of the web-infmails under Tomcat, which can also start, but will report an error, pay attention to Web.xml: in Tomcat. Org.apache.jasper.servlet.jspservlet Solution is to make it clean with Web.xml under your web-infers: myProject This is OK.

To set up servlet under different versions of Tomcat: Copy your own servlet.class to your own project's Web-INF / CLASSES, then in Tomcat's Web.xml: Invoker org.apache.catalina.servlets.invokerservlet debug 0 2 If this paragraph is commented, you can get it ------------ ---------------------------------------- Invoker / servlet / * This Tomcat 4.1.31 previous version requires yourself to join, 4.1.31 and 5 series Tomcat as long as The annotation removed from this paragraph. In addition, after setting the Web.xml of Tomcat, you will need to return to your own project path to set Web.xml, the content is as follows: firstservlet HelloWorldServlet then entered in the address: http://127.0.0.1/example/servlet/firstServlet This you can visit your own servlet HelloWorldServlet .java ------------------------- Import javax.servlet. *; import javax.servlet.http. *; public class helloworldServlet Extends httpservlet { public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {PrintWriter pw = response.getWriter (); pw.println ( ""); pw.println ( ""); pw.println ( ""); PW.Println (""); PW.Println ("

Hello! ); PW.Println (" "); PW. Println ("");}} * If reproduced, please note http://blog.9cbs.net/darkula

转载请注明原文地址:https://www.9cbs.com/read-91220.html

New Post(0)