Tuesday, April 15, 2008

Listeners-Points to note

 

Getvalue() method of AttributeEventlisteners return old value of attribute if it is replaced.

 
<listener-class> is only required attribute for <listener> in web.xml
Container uses DD to determine notification order of registered listeners

 

For example,

public class Test1 implements ServletRequestAttributeListener

{

            public void attributeAdded(ServletRequestAttributeEvent event)

    {

            System.out.println("-- test1 attributeAdded--");

    

 

    }

}

 

public class Test2 implements ServletRequestAttributeListener

{

            public void attributeAdded(ServletRequestAttributeEvent event)

    {

            System.out.println("-- Test2 attributeAdded--");

    

 

    }

}

 

Web.xml:

 

<listener>

                        <listener-class>com.honeywell.sspglobal.report.dao.Test1</listener-class>

            </listener>

 

            <listener>

                        <listener-class>com.honeywell.sspglobal.report.dao.Test2</listener-class>

            </listener>

 

Output:

[4/15/08 15:34:46:392 IST] 000000c9 SystemOut     O -- test1 attributeAdded--

[4/15/08 15:34:46:392 IST] 000000c9 SystemOut     O -- Test2 attributeAdded--

No comments:

Post a Comment