• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai raza,
u r used init(){} in that servlet working properly in my system.
I used jws2.0.
madhu
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic