tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Bacon <>
Subject Init params revisited
Date Tue, 12 Sep 2000 21:04:22 GMT
   I'm having a problem with initialization parameters, and upon searching 
the last week's digests, came upon a very similar question and solution, 
but it doesn't quite match what I'm trying to do, so if the list doesn't 
mind, I'll ask a very similar q.
I've been running through Sun's "Core Servlets and JavaServer Pages" and 
following its example, tried to use init params. Unfortunately, they're not 
getting retrieved. The web.xml is set up correctly enough so that I can 
access the class via its mapped name "Test1" and not the actual 
servlet-class name, but I'm retrieving NULLs. I'm running Apache 1.3.12 and 
Tomcat 3.1 under RH Linux 6.2
I notice many solutions refer to context params, but I assume init params 
are better to use as they're only for this particular class and not all 
classes in this context.
Any help / pointers appreciated.

Here's my web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

   <display-name>STB Tests</display-name>
     Test application (STB)

and here's the init method from my servlet:

   public void init(ServletConfig config)
     throws ServletException {
     // always call super.init

     sFormatOpen = config.getInitParameter("formatopen");
     if (sFormatOpen == null) {
       sFormatOpen = "";
       sFormatClose = "";
     else {
       sFormatClose = config.getInitParameter("formatclose");
       if (sFormatClose == null) {
         sFormatOpen = "";
         sFormatClose = "";

View raw message