i think is normal to have 2 class instances.
one is created by the server to handle attributeAdded,etc
and the second instance is created by you in the jsp...
a class instance has application level not the class name.
Dave Ford wrote:
>
> I have a class which implements the ServletContextAttributesListener
> interface. It has been registered as a listener in web.xml. The problem is,
> Orion is creating two instances. Shouldn't there only be ONE instance of an
> application level object?
>
> Here is the class:
>
> import javax.servlet.*;
> public class Foo implements ServletContextAttributesListener {
> public void attributeAdded(ServletContextAttributeEvent ev) {
> System.out.println(this + " - Foo.servletContextAttributeAdded: " +
> ev.getName());
> }
> public void attributeReplaced(ServletContextAttributeEvent event) {}
> public void attributeRemoved(ServletContextAttributeEvent event) {}
> public void test(){
> System.out.println(this + " - Foo.test");
> }
> }
>
> Here is a JSP that uses the class:
>
> <jsp:useBean id="f" class="Foo" scope="application"/> (line 1)
> <% f.test(); %> (line 2)
>
> Here is the output:
>
> Foo@7808b9 - Foo.servletContextAttributeAdded: f
> Foo@4da23 - Foo.test
>
> If you look at the memory addresses, you'll see that there are two
> instances.
>
> Is this a bug or am I misunderstanding something?
___________________________________________________________________________
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