1. Use the editor you are most familiar with (it is recommended to use the Java IDE with syntax check), the file name is Test.java, the file content is as follows:
Package test;
Import java.io.ioException;
Import java.io.printwriter;
Import javax.servlet.servletException;
Import javax.servlet.http.httpservlet;
Import javax.servlet.http.httpservletRequest;
Import javax.servlet.http.httpservletResponse;
Public class test extends httpservlet {
Protected Void Doget (HttpservletRequest Request, HttpservletResponse Response)
Throws servletexception, ioException {
PrintWriter out = response.getwriter ();
Out.println ("
Out.flush ();
}
}
2. Compile Test.java Under C: / Test, compile: C: / test> Javac test.java then generate a compiled servlet file under C: / Test: Test.class
3. Cut the structure Test / Test.class to% catalina_home% / WebApps / myApp / web-inf / class, that is, cut that Test directory to the class content, if the class content does not exist, will create a new one. Now WebApps / MyApp / Web-INF / CLASSES has Test / Test.class file directory structure
4. Modify WebAPPS / MyApp / Web-INF / Web.xml, add servlet and servlet-maping edited Web.xml as follows: XML Version = "1.0" eNCoding = "ISO-8859-1?>