Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find servlet init parameters

 
Toby Davis
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to grab initialization parameters for my servlet, based on params established in my deployment descriptor. Yet my servlet can't find any of them (returns nulls).
This is in my deployment descriptor snippet for a particular servlet:

Yet, in my servlet, it cannot read any of the initialization parameters (in the init() method of MyServletController snippet below):

The above code snippet would return strParam as null. In fact, no matter what's in the deployment descriptor for this servlet, no initialization parameters can be found. I know the web.xml is deployed properly, otherwise this servlet could not be invoked in the first place.
Something I'm missing that's simple I hope?
--
[ June 05, 2002: Message edited by: Toby Davis ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pretty odd alright. Just for fun try working with the config object directly.

The other thing you might try is to rearrange the order of elements in web.xml - the Sun examples always put servlet-class right after servlet-name, and then put init-param elements so thats the way I have always done it.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic