httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Genty <tge...@alicante.fr>
Subject web.xml
Date Tue, 14 Aug 2001 10:46:44 GMT
Hi,
I'm using Tomcat 3.2.1 but I have some problem with <load-on-startup>.
I have a servlet which should just be use to get initParameter and put
them in the ServletContext for my other servlet/JSP use them but an
error tell me the servlet cannot be load why?
Here the web.xml file and the servlet :

WEB.XML
<?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>initAll</servlet-name>
    <servlet-class>Init</servlet-class>
    <init-param>
      <param-name>images</param-name>
      <param-value>images</param-value>
    </init-param>
    <init-param>
      <param-name>dataPath</param-name>
      <param-value>data</param-value>
    </init-param>
    <init-param>
      <param-name>internet</param-name>
      <param-value>internet</param-value>
    </init-param>
    <init-param>
      <param-name>intranet</param-name>
      <param-value>intranet</param-value>
    </init-param>
    <init-param>
      <param-name>LocalBase</param-name>

<param-value>c:\jakarta-tomcat-3.2.1\webapps\netarras\realisation\maquettes\</param-value>

    </init-param>
    <init-param>
      <param-name>host</param-name>
      <param-value>http://palerme:8080/</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>



  <servlet>
    <servlet-name>process</servlet-name>
    <jsp-file>/realisation/maquettes/jsp/process.jsp</jsp-file>
  </servlet>

  <servlet>
    <servlet-name>modify</servlet-name>
    <jsp-file>/realisation/maquettes/jsp/modify.jsp</jsp-file>
  </servlet>

  <servlet>
    <servlet-name>modif</servlet-name>
    <jsp-file>/realisation/maquettes/jsp/modif.jsp</jsp-file>
  </servlet>

  <servlet-mapping>
    <servlet-name>initAll</servlet-name>
    <url-pattern>/initAll</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>process</servlet-name>
    <url-pattern>/process</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>modify</servlet-name>
    <url-pattern>/modify</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>modif</servlet-name>
    <url-pattern>/modif</url-pattern>
  </servlet-mapping>

</web-app>

*** Init.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

// servlet just launch init parameters and set them in ServletContext

public class Init extends HttpServlet{

  public void init(ServletConfig config){
    super.init(config);
    System.out.println("Entering Init");
    Properties props=new Properties();
    for (Enumeration
e=config.getInitParameterNames();e.hasMoreElements();){
      String key=(String)e.nextElement();
      props.put(key,config.getInitParameter(key));
    }
    ServletContext context=getServletContext();
    context.setAttribute("data",props);
    System.out.println("Init Done");
  }

}

the local dir is
c:\jakarta-tomcat-3.2.1\webapps\netarras\WEB-INF\classes

Thanks in advance



--
GENTY Tony
IUP GMI
Stagiaire Alicante



Mime
View raw message