Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Configuration file..

 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have just started learning Servlets and am using Resin1.2.1 as my servlet engine. I am trying to access the initialization parameter from a web.xml file which I placed in the /install-dir/doc/Web-inf/classes directory. My class file is in /install-dir/doc/Web-inf/classes/<package-name>/<classfile>.
When I run the servlet from Internet Explorer it cannot find the
parameter and hence prints a default message which I supplied in my code.
Can anybody help me with this problem.
Thank you in advance,
Chuck
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Web.xml is pretty sensitive to syntax and the order of elements.
Here is an example that creates an alias and provides a single init paramater.
<servlet><servlet-name>saynumb.au</servlet-name>
<servlet-class>com.JSPbook.Chap04.NumberSoundServ</servlet-class>
<init-param>
<param-name>basepath</param-name>
<param-value>c:\\tomcat\\webapps\\Root\\JSPbook\\Chap04\\sounds</param-value>
</init-param>
</servlet>
Incidently be sure that directory name is WEB-INF, all caps.
Bill

------------------
author of:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic