package grewe.servlets.myDBServlet 
       
        
      import java.io.*;  
        import javax.servlet.*;  
        import javax.servlet.http.*; 
       /**Servlet that opens up server's servlet parameter file to look up 
        the name of  
             the Database host machine and the SID used 
        for connection.  
             Currently, simply prints out the information 
        to the client web-browser but,  
             could be made later to actually open up a 
        connection and process DB requests. 
           @author  Lynne Grewe  
            @since  2001  
          */ 
       public class myDBServlet extends HttpServlet {  
          
           private String  DBHost;  
            private String DBSID; 
           //method called first time Servlet is invoked 
         
            //read in the parameters about the DB.  
            public void init(ServletConfig c) throws ServletException 
        { 
               //must always call parent's 
        method!!!  
                super.init(c); 
              //retrieve parameters  
                DBHost = c.getInitParameter("DataBaseMachine"); 
               DBSID = c.getInitParameter("DataBaseSID"); 
           }  
          
          
            //method called when user requests URL of this servlet 
         
            //Currently, simply prints out DB parameters read 
        in.  
            public void doGet)(HttpServletRequest req, HttpServletResponse 
        res)  
                    
        throws ServletException, IOException { 
                   
        res.setContentType("text/html");  //tell what we are returning 
         
                    
        PrintWriter out = res.getWriter();  
                    
        String title = "The DataBase Servlet";  
                    
        out.println(ServletUtilities.headWithTitle(title) +  
                                       
        "<BODY bgcolor=\"yellow\" > \n" +  
                                       
        "<Center><H2>Database Parameters</H2></Center> \n" +  
                                       
        "<b>Database Host: </b>" + DBHost + "\n" +  
                                       
        "<b>Database SID: </b>" + DBSID + "\n" +  
                                       
        "</BODY></HTML>");  
             }  
          
       }  
           
          
        |