tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Morahg, Yoav" <ymor...@gist.com>
Subject RE: Frustration with getInitParameter
Date Thu, 26 Oct 2000 16:12:29 GMT
I wouldn't say that's Tomcat... unless you've got something configured
wrong. I use <init-param>s in my web.xml file and I can access them from my
servlet. I have the parameters in my web.xml file as you do then in my
servlet I have an init method
public void init(ServletConfig config) throws ServletException
 
and then I can access my parameters within  init via
config.getInitParamater("parameter name")
 
Is this what you are doing?
 
-Yoav
 

--------------------------- 
Yoav Morahg 
Software Engineer 
Gist Communications 
(212) 965-1999 xt 110 
ymorahg@gist.com 

Interactive Television Guides 

-----Original Message-----
From: Paul Hoepfner-Homme [mailto:paulh@oven.com]
Sent: Thursday, October 26, 2000 11:58 AM
To: tomcat-user@jakarta.apache.org
Subject: Re: Frustration with getInitParameter


Just so y'all know, I can use context-params fine, but no init-params for my
servlet work at all.  It is useless to define <init-param> tags in between
my <servlet> tags in web.xml because Tomcat doesn't register them or make
them available to my servlet.  Tomcat only makes available <context-param>
definitions.  Oh well, that's Tomcat... 

Paul 


Paul Hoepfner-Homme wrote: 


Paul Hoepfner-Homme wrote: 

Yes, this is what I am trying to do.  Maybe I'll try overriding the init()
method of my servlet and try to call it up from there, but as you say, the
docs say I should be able to do it from within a service method, so I
shouldn't have to do this.

No such luck.  Even when I override init() and in there use getInitParameter
from my ServletConfig, there are still zero init parameters, yet I have now
defined six in web.xml for this servlet context.  And they are <init-param>s
inside the <servlet> definition, not <context-param>s as some people have
mistakenly tried and then complained on the mailing list that they couldn't
access the values using getInitParameter(). 

Please help! 


> -----Original Message----- 
> From: Paul Hoepfner-Homme [SMTP:paulh@oven.com] 
> Sent: Thursday, October 26, 2000 4:26 PM 
> To:   tomcat-user@jakarta.apache.org 
> Subject:      Frustration with getInitParameter 
> 
> Tomcat 3.2 beta 6.  I have a servlet in the ROOT context.  The web.xml 
> file in webapps/ROOT/WEB-INF has this entry: 
> <servlet> 
>     <servlet-name>...</servlet-name> 
>     <servlet-class>MyServlet</servlet-class> 
>     <init-param> 
>         <param-name>test</param-name> 
>         <param-value>here</param-value> 
>     </init-param> 
>     ... 
> </servlet> 
> 
> From MyServlet I use the servlet's getInitParameter("test") method and it 
> returns null.  When I try to iterate through the parameter names, there 
> are none to iterate through. 
> 
> What am I doing wrong?? 
> 
> Thanks 
> -- 
> Paul Hoepfner-Homme 
> paulh@oven.com 
> 
> OVEN Digital |  < http://www.oven.com/ <http://www.oven.com/> > 
>

--

Paul Hoepfner-Homme

paulh@oven.com



OVEN Digital |  http://www.oven.com/ <http://www.oven.com/> 
 

--

Paul Hoepfner-Homme

paulh@oven.com



OVEN Digital |  http://www.oven.com/ <http://www.oven.com/> 
 

--

Paul Hoepfner-Homme

paulh@oven.com



OVEN Digital |  http://www.oven.com/ <http://www.oven.com/> 
  


Mime
View raw message