set path=%java_Home%\bin
set classpath=jar包的路径;jar包的路径
javac *.java
pause
package test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
pulic class Test extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{
PrintWriter out=response.getWriter();
out.println("<html><body><h3>This is a servlet test.</h3></body></html>");
out.flush();
}
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
******
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<description>
A application for test
</description>
<servlet>
<servlet-name>Test</servlet-name>
<display-name>Test</display-name>
<description>
A test for servlet.
</description>
<servlet-class>test.Test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
</web-app>
\myapp\WEB-INF\classes\test