Re: Seems like my servlet isn't overloading the init() method..can someone plz help?
From: Tony Morris (not_at_telling.you)
Date: 03/03/05
- Next message: Tilman Bohn: "Re: Vector vs ArrayList"
- Previous message: fxn_at_hashref.com: "Re: How to speed up a simple paintComponent()"
- In reply to: carlos80_at_gmail.com: "Seems like my servlet isn't overloading the init() method..can someone plz help?"
- Next in thread: Karel Suikers: "Re: Seems like my servlet isn't overloading the init() method..can someone plz help?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 03 Mar 2005 10:40:50 GMT
<carlos80@gmail.com> wrote in message
news:1109843689.138431.180320@l41g2000cwc.googlegroups.com...
> Hi,
>
> I've been struggling with this problem all night, and I feel like I'm
> just missing something.
>
> I'm basically trying to run some code in the init() method in my
> servlet. However the method doesn't seem to be getting called. I know
> that the init() method is only called once the first time the servlet
> gets called, and that is exactly why I'm stuck with this problem.
>
> Here is a sample of my code
>
> public class MyServletA extends HttpServlet {
> // Page names
> private static int a;
>
> public void init() throws ServletException {
> super.init();
> a = 4;
> System.out.println("init");
> }
>
> public void doPost(...) {
> System.out.println(a);
> }
> }
>
> When I start the server and load the jsp that calls MyServletA I never
> get the "init" to print out, and when doPost gets called a = 0 and not
> 4.
>
> Can someone please shed some light in this? Thanks
>
The application server has almost certainly redirected the standard output
stream.
Also, you haven't overloaded the init method, you have overridden it - an
important distinction.
Search the application server documentation for where it redirects the
standard output stream - typically, some file in the logs.
-- Tony Morris http://xdweb.net/~dibblego/
- Next message: Tilman Bohn: "Re: Vector vs ArrayList"
- Previous message: fxn_at_hashref.com: "Re: How to speed up a simple paintComponent()"
- In reply to: carlos80_at_gmail.com: "Seems like my servlet isn't overloading the init() method..can someone plz help?"
- Next in thread: Karel Suikers: "Re: Seems like my servlet isn't overloading the init() method..can someone plz help?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|