The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Using in web.xml for a servlet parameter in Tomcat 3.2.2?

Posted by mike on July 11, 2001 at 4:30 PM


We are Using Tomcat 3.2.2 on SunOS 5.6.

I am trying to add a custom parameter to web.xml to be used as my servlet is initialized.
The relevant piece of web.xml looks something like this:


Within the servlet's init(), I am using something like the following to try to retrieve the value of this parameter:

public class testServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException
sc = config.getServletContext();

String p1Attribute = sc.getAttribute("param1"));
String p1InitParram = sc.getInitParameter("param1"));

The value returned is always null. Tried this with the example called "" that comes with 3.2.2., and can't get that to work either.

Has anyone had any luck with this sort of thing? Thanks!


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us