Hi,
  I am having the following problem:

  I'm trying to access some parameters (e.g: "message") defined in web.xml file 
but they are not seen in servlet class;
My servlet works fine in the rest.
(I invoke it : http://localhost/servlet/coreservlets.ShowMessage )

$CATALINA_HOME/webapps/ROOT/WEB-INF/classes/coreservlets/ShowMessage.class:

package coreservlets;
------------------------------
...output omitted...
------------------------------
public class ShowMessage extends HttpServlet {
  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"); // returns null
    if (message == null) {
      message = defaultMessage;
    }
------------------------------
 ...output omitted...
 ------------------------------

$CATALINA_HOME/webapps/ROOT/WEB-INF/classes/web.xml file:

<?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>ShowMsg</servlet-name>
    <servlet-class>coreservlets.ShowMessage</servlet-class>
    <init-param>
      <param-name>message</param-name>
      <param-value>Shibboleth</param-value>
    </init-param>
    <init-param>
      <param-name>repeats</param-name>
      <param-value>5</param-value>
    </init-param>
  </servlet>
</web-app>

Thanks,
Silviu

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to