if you're running on a servlet engine implementing (2.0 <
api), this
is the result.  ServleContext snooping was deprecated in 2.1
& 2.2

robert young


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's
Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On
Behalf Of Usha
Sent: Monday, June 05, 2000 8:23 AM
To: [EMAIL PROTECTED]
Subject: Loaded Servlets Problem


Hi friends

I am trying to get the list of servlets tht are loaded by
the Web server (
Java Web Server )
According to me the servlet which is running should be there
in the list of
loaded servlets. But when i try to get tht servlet in get a
null. Is there
something tht i am missing out. I have attached my code
below

Thanks in advance

Regards
Usha.


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

public class ShowNameServlet extends HttpServlet{
        public void doGet(HttpServletRequest req,
HttpServletResponse res) throws
IOException, ServletException
        {
                res.setContentType("text/html");
                PrintWriter out = res.getWriter();
                out.println("<html>Hello");

                Enumeration e =
getServletContext().getServletNames();
                Servlet s =
getServletContext().getServlet("LoadedServlets");
                out.println("Servlet Name = " + s);
                while(e.hasMoreElements())
                {
                        out.println("HI");

out.println((String)e.nextElement());
                }
                out.println("</html>");
        }
}
------------------------------------------------------------
------------
---------------------------
A Champion is not one who never fails, but one who NEVER
QUITS !

____________________________________________________________
_______________
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

___________________________________________________________________________
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