public class PyServlet
extends javax.servlet.http.HttpServlet
e.g. http://localhost:8080/test/hello.py
 from javax.servlet.http import HttpServlet
 class hello(HttpServlet):
     def doGet(self, req, res):
         res.setContentType("text/html");
         out = res.getOutputStream()
         print >>out, ""
         print >>out, "Hello World, How are we? "
         print >>out, "Hello World, how are we?"
         print >>out, ""
         print >>out, ""
         out.close()
 
 in web.xml for the PyServlet context:
 
 <web-app>
     <servlet>
         <servlet-name>PyServlet</servlet-name>
         <servlet-class>org.python.util.PyServlet</servlet-class>
         <init-param>
             <param-name>python.home</param-name>
             <param-value>/usr/home/jython-2.5</param-value>
         </init-param>
     </servlet>
     <servlet-mapping>
         <servlet-name>PyServlet</servlet-name>
         <url-pattern>*.py</url-pattern>
     </servlet-mapping>
 </web-app>
 | Modifier and Type | Field and Description | 
|---|---|
| static String | SKIP_INIT_NAME | 
| Constructor and Description | 
|---|
| PyServlet() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | destroy() | 
| void | init() | 
| void | reset()Clears the cache of loaded servlets and makes a new PythonInterpreter to service further
 requests. | 
| void | service(javax.servlet.ServletRequest req,
       javax.servlet.ServletResponse res) | 
public static final String SKIP_INIT_NAME
public void init()
init in class javax.servlet.GenericServletpublic void service(javax.servlet.ServletRequest req,
                    javax.servlet.ServletResponse res)
             throws javax.servlet.ServletException,
                    IOException
service in interface javax.servlet.Servletservice in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionpublic void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServletpublic void reset()