I was going thru the InterServlet Communication chapter of the book by
J.Hunter. I simply copied the following code from his book. But it does
n't works. I am using Java Webser Server.

CAn anyone help me in solving the problem.. Following is the code..


import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Loaded extends HttpServlet {

  public void doGet(HttpServletRequest req, HttpServletResponse res)
                               throws ServletException, IOException {
    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();

    ServletContext context = getServletContext();
    Enumeration names = context.getServletNames();
    while (names.hasMoreElements()) {
      String name = (String)names.nextElement();
      Servlet servlet = context.getServlet(name);
      out.println("Servlet name: " + name);
      out.println("Servlet class: " + servlet.getClass().getName());
      out.println("Servlet info: " + servlet.getServletInfo());
      out.println();
    }
  }
}
--
Debashis Das
Tata Consultancy Services
Phone Nos.: Office:(303) 896-8548, Home: (720) 941-9057

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to