Hi Murthy,
it's a problem of servlet mapping. With web.xml like yours
<web-app>
<servlet>
<servlet-name>
Test
</servlet-name>
<servlet-class>
InitTest
</servlet-class>
<init-param>
<param-name>
host
</param-name>
<param-value>
basie.ittc.ku.edu
</param-value>
</init-param>
</servlet>
</web-app>
slightly modified your servlet code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InitTest extends HttpServlet {
public String host;
public String name;
public void init(ServletConfig config) throws ServletException {
super.init(config);
host = config.getInitParameter("host");
name = getServletConfig().getServletName();
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.println("<html><head><title>Hello</title></head>");
out.println("<body>this is string for parameter host : "+host +"<br/>");
out.println("<body>this is string for Servlet name : "+name+"<br/>");
out.println("</body></html>");
}
}
generates following output
this is string for parameter host : null
this is string for Servlet name : org.apache.catalina.INVOKER.InitTest
as there is no init parameter defined for servlet (strictly) named
org.apache.catalina.INVOKER.InitTest
But the same servlet with mapping section
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
gives requested result
this is string for parameter host : basie.ittc.ku.edu
this is string for Servlet name : Test
Best regards,
Piotr
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html