1

Now I am reading servlet action listener. My question is how container know which class is listener?

Sotirios Delimanolis
  • 252,278
  • 54
  • 635
  • 683
ieQsan
  • 133
  • 1
  • 9

3 Answers3

1

listeners are defined in the web.xml file descriptor. See the docs for more information. Notably:

Create an event listener class by implementing the appropriate interface or interfaces of the javax.servlet package or javax.servlet.http package.

Event listeners are declared in the application web.xml deployment descriptor through elements under the top-level element. Each listener has its own element, with a subelement specifying the class name. Within each event category, event listeners should be specified in the order in which you would like them to be invoked when the application runs.

leeor
  • 14,718
  • 5
  • 28
  • 58
0

in web.xml you can find it

<listener>
        <listener-class></listener-class>
    </listener>
JAVAC
  • 1,062
  • 2
  • 15
  • 32
0

We specify in DD

Ex:

<listener>
    <listener-class>javax.servlet.ServletContextListene</listener-class>
</listener>
Saravana
  • 11,085
  • 2
  • 29
  • 43