That did the trick - thankyou!

-----Original Message-----
From: Peacock, Michael [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 09, 2000 3:33 PM
To: [EMAIL PROTECTED]
Subject: RE: servlet reloading.


Andrew - 

Try adding the following line at the beginning of your init method:

super.init(config);

I think the issue is that when you override init(), you're not running the
HttpServlet.init().  In the earlier case, when you didn't override init(),
the HttpServlet.init() would run as part of your servlet's construction.

Cheers, Michael

Michael Peacock
EC Web Developer 
Avnet 


> -----Original Message-----
> From: Andrew Phelps [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 09, 2000 8:18 AM
> To: '[EMAIL PROTECTED]'
> Subject: servlet reloading.
> 
> 
> Recently there was a discussion about the servlet reloading 
> mechanism in
> java web servers.
> 
> At the time I felt comfortable with the mechanism, but have recently
> discovered a feature that I do not understand.
> 
> I have a basic servlet that ONLY overrides doGet().  When 
> called the servlet
> responds correctly. If I alter and recompile the servlet - and do not
> restart the server - again the servlet responds correctly with the
> alteration.
> 
> However, if I also override init() then the mechanism falls 
> apart.  The
> below example servlet will work correctly the first time it 
> is compiled.
> However, when an alteration is made (e.g. in doGet()) the 
> server fails to
> reload the servlet correctly.
> 
> Can anyone shed some light on what is happening internally?
> 
> Much appretiated,
> 
> Andy Phelps
> 
> == example follows ==
>  
> package test;
> 
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> 
> public class Output extends HttpServlet {
> 
>     int testInt;
> 
>     public void init(ServletConfig config){
>         testInt = 0;
>     }
> 
>     public void doGet(HttpServletRequest req, HttpServletResponse res)
>                                throws ServletException, IOException {
>         res.setContentType("text/html");
>         PrintWriter out = res.getWriter();
>         out.println("Test output<BR>");  // change this 
> output, compile and
> load = exception
>         out.println("counter = " + testInt++);
>      }
> }
> --------------------------------------------------------------
> ----------------
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe: 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
----------------------------------------------------------------------------
--
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to