<?xml version='1.0' encoding='utf-8'?>
<Context reloadable="true" privileged="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
1. 서블릿 클래스를 작성한다.
2. 서블릿 클래스를 컴파일한다.
javac -cp %CATALINA_HOME%\lib\servlet-api.jar ...
or
"C:\Program Files\Java\jdk1.6.0_32\jre\lib\ext\servlet-api.jar"
3. 서블릿 클래스를 설치한다.
%APP_HOME%\WEB-INF\classes\HundredServlet.class
변경시 톰캣은 웹 애플리케이션을 수동으로 리로드해야 될 수도 있다.
http://localhost:8080/manager/html
4. 서블릿 클래스를 등록한다.
%APP_HOME%\WEB-INF\web.xml
web application deployment descriptor 파일
변경시 톰캣의 경우 웹 애플리케이션을 자동으로 리로드한다.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<servlet-name>hundred-servlet</servlet-name>
<servlet-class>HundredServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hundred-servlet</servlet-name>
<url-pattern>/hundred</url-pattern>
</servlet-mapping>
</web-app>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>