Paul,

Getting the error because "application" is a JSP default object for
javax.Servlet.ServletContext

If you want to put someting in the servlet context, use something like

this.getServletContext.setAttribute()

Not too sure about the correct method names,but you should get the idea

Bill

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Monday, 25 November 2002 4:01 PM
To: Tomcat Users List
Subject: session /application in servlets


Hi,
        Pertaining to recent posts, can someone please describe how
session or application are defined in a servlet please? In JSP syntax
there is no problem but in the method in the .java servlet below:

public class LoadMyServletAtStartup implements ServletContextListener {

  public void contextInitialized(ServletContextEvent sce) {

    Hashtable style_index = new Hashtable();

    style_index.put("element1", "ONE");
    style_index.put("element2", "TWO");

    application.setAttribute("style_index", style_index);

    }

it is failing to compile:

unable to resolve symbol
application.setAttribute("style_index", style_index);
^
1 Error

many thanks for your help

Paul.





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to