Hello everyone,

I've been learning jsp with Tomcat 3.1 recently, encountered a small problem:
In web.xml I setup initialization parameters to one sevlet, but the servlet was not 
picking them when running, the piece of code for initialization is as follows:

private String message;
private String defaultMessage = "No message.";
private int repeats = 1;

public void init(ServletConfig config) throws ServletException {
        super.init(config);
        message = config.getInitParameter("message");
        if (message == null) message = defaultMessage;
        try {
                String repeatString = config.getInitParameter("repeats");
                repeats = Integer.parseInt(repeatString);
        } catch (NumberFormatException nfe) {}
}

Any ideas? BTW, this example is from Chapter 2 of "Core Servlets and JavaServer Pages" 
authored by Marty Hall.

Thanks a lot,
William

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to