RE: init parameters acces

2002-11-21 Thread Shapira, Yoav
Hi,
Check the tomcat logs on startup: if you posted your entire web.xml,
then your web.xml is incomplete and you'll see errors in the tomcat
logs.

Furthermore, as a matter of good design, don't override
init(ServletConfig config).  Override init() instead.  That way you
don't have to call init(config) yourself.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Javier Linares [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 12:59 PM
To: [EMAIL PROTECTED]
Subject: init parameters acces

Hi,

I'm trying to access my init parameters in my web.xml file located in
my
install_dir/webapps/ROOT/WEB-INF folder with this init method:

public void init(ServletConfig config) throws ServletException
{
super.init(config);
message = config.getInitParameter(message);
servletName = config.getServletName();
}

Here's my web.xml:

web-app
servlet
servlet-name
ShowMsg
/servlet-name
servlet-class
coreservlets.ShowMessage
/servlet-class

init-param
param-name
message
/param-name
param-value
whatever
/param-value
/init-param
/web-app

Unfortunately, message is always return as null by
config.getInitParameter(message).

Is my web.xml file in the correct folder?

Thanx for the answer

Javier


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: init parameters acces

2002-11-20 Thread Jeanfrancois Arcand
From you web.xml fragment, seems some element are missing. First, the 
servlet element is not closed.

Are you sure you web.xml file is parsed properly?

-- Jeanfrancois

Javier Linares wrote:

Hi,

I'm trying to access my init parameters in my web.xml file located in my install_dir/webapps/ROOT/WEB-INF folder with this init method:

   public void init(ServletConfig config) throws ServletException 
   {
   super.init(config);
   message = config.getInitParameter(message);
   servletName = config.getServletName();
   }

Here's my web.xml:

web-app
   servlet
   servlet-name
   ShowMsg 
   /servlet-name
   servlet-class 
   coreservlets.ShowMessage 
   /servlet-class
   
   init-param 
   param-name 
   message 
   /param-name
   param-value 
   whatever 
   /param-value
   /init-param
/web-app

Unfortunately, message is always return as null by config.getInitParameter(message).

Is my web.xml file in the correct folder?

Thanx for the answer

Javier


 



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]