This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi All I'm trying to set initial value in a sevlet. i'm using tomcat3.1,or jsdk2. with Tomcat you have to create an xml file and set the name of the servlet and the name and the value of the parameter. but there is a default web.xml file in web-inf. do i have to just put a name for a file with extension xml and put it along with the default file(web.xml? or i have to move that default file(web.xml) and put it somewhere and name my file web.xml and put it at that directory(web-inf). really i do not know and that what i did,but i got just null. that means something wrong and the that parameter doesn't exist. here is the files: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd"> <web-app> <servlet> <servlet-name> initParameter </servlet-name> <servlet-class> initPara </servlet-class> <init-param> <param-name>initial</param-name> <param-value>matt</param-value> </init-param> </servlet>
</web-app> here is the servlet file: import javax.servlet.*; import javax.servlet.http.*; import java.io.*;
The default web.xml should work for experimentation. As I understand it you only use the application specific web.xml files to specify parameters for those applications that may override the default. Double-check the spelling and the use of upper/lower case in your servlet name and class name. Bill