Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to register the listeners

 
narendra darlanka
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i read that we can register ServletContextListener by using the deployment descriptor.but how do i register other listeners like HttpSessionListener ,HttpRequestListener?

thanks inadvance
 
Sergey Tyulkin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the same way:
<listener>
<listener-class>
com.my.ImplementationOfHttpRequestListener
</listener-class>
</listener>
 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All listeners are registed through the web.xml
listeners tag. They are automatically used appropriately (probably using instanceof ).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic