Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem: code in init() not executing, while code in init(ServletConfig conf) works:

 
zulfiqar raza
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am running ApacheJServ1.1 on Apache 1.3.12 web server. I have a strange problem. If I put something in the init() method e.g. to initialize a variable the variable never gets initialized. While If i change the init() method to init(ServletConfig conf) and put code in this method, it works fine.
Thank you all in advance.
Below are the two code. First one does not work, the second one works fine.

The following works fine. Note I just changed the init() method.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Servlet interface requires init( ServletConfig )
As a "convenience" the GenericServlet class added init() - inside GenericServlet the init( ServletConfig ) method calls init() - presumably the one your servlet overrides.
I'm not sure when this "convenience" method was added to the API - maybe JServ 1.1 doesn't implement it.
Remember, you MUST call super.init(config) if you are using the init( ServletConfig ) method.
Bill

------------------
author of:
 
zulfiqar raza
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill, This clears up the confusion. I upgraded to JServ 1.1.2 , but seems like the same problem. Then again JServ uses JSDK2.0 and not JSDK2.1 still.

thanks,
zulfiqar raza
 
madhu babu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai raza,
u r used init(){} in that servlet working properly in my system.
I used jws2.0.
madhu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic