Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Cannot find servlet init parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cannot find servlet init parameters" Watch "Cannot find servlet init parameters" New topic
Author

Cannot find servlet init parameters

Toby Davis
Ranch Hand

Joined: Apr 09, 2002
Posts: 65
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 ]

SCJP2 (1.4)
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot find servlet init parameters
 
Similar Threads
ServletContext Vs ServletConfig
Servletconfig?
Servlet init param (JavaRanch mock question)
problem in getInitParameterNames() method of ServletConfig
ELEMENT init-param(param-name, param-value, description?