You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/11/21 14:33:24 UTC

DO NOT REPLY [Bug 14736] New: - Unable to set servlet init parameters from web.xml and application context

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14736>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14736

Unable to set servlet init parameters from web.xml and application context

           Summary: Unable to set servlet init parameters from web.xml and
                    application context
           Product: Tomcat 4
           Version: 4.1.12
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: boris@ipunplugged.com


When trying to set the context parameter according to:

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html
Both in the WEB-INF/web.xml and in a application context file the parameters can
not be read from the servlet with ServletContext.getInitParameter().

--------------------------
catalina/webapps/webapp.xml:

<!-- R-Server context -->
<Context path="/boris/web" docBase="/home/boris/work/rs-home/war/web/web"
      debug="1" reloadable="true" crossContext="false">
      
    <Parameter name="LoggerName" value="rserver-web" override="false"/>
 
</Context>

------------------------
WEB-INF/web.xml :

<!DOCTYPE web-app 
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>Server Administration Interface</display-name>
    <description>
	The Server administration interface.
    </description>

    <!-- Change these values -->
    <context-param>
      <param-name>LoggerName</param-name>
      <param-value>rserver-web</param-value>
    </context-param>

    <servlet>
        <servlet-name>Server</servlet-name>
        <servlet-class>com.ipunplugged.AppServlet</servlet-class>
    </servlet>

 </web-app>
   
--------------------------

ApplicationServelet.java :

public class AppServlet extends HttpServlet {

    public void init() {
        String name = getServletConfig().getInitParameter("LoggerName");
        if(name == null)
                Log.error("Missing logger name"); // always !
        }
    }
}

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>