Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9024481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:01:20+00:00 2026-06-16T06:01:20+00:00

I have one listener configured in web.xml <listener> <listener-class>com.Mylistener</listener-class> </listener> MyListener.java has following code

  • 0

I have one listener configured in web.xml

<listener>
      <listener-class>com.Mylistener</listener-class>
</listener>

MyListener.java

has following code

 public class MyListener extends HttpSessionEventPublisher{

           myServiceInterface myService;

           @Override
           public void sessionCreated(HttpSessionEvent event) {     
              super.sessionCreated(event);
           }

           @Override
           public void sessionDestroyed(HttpSessionEvent event) {
             //Call a method from service layer which is communicating with DAO layer and then database.
    super.sessionDestroyed(event);
           }

    }

That service already had its own mapping and working fine.

what other mappings, i need to do to call service layer in Mylistener, above code it not working at all

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:01:21+00:00Added an answer on June 16, 2026 at 6:01 am
    public class MyListener extends HttpSessionEventPublisher {
        @Override
        public void sessionDestroyed(final HttpSessionEvent event) {
            final ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(event.getSession().getServletContext());
            final MyServiceInterface service = ctx.getBean(MyServiceInterface.class);
            // use service
            super.sessionDestroyed(event);
        }
    }    
    

    Should work (not tested).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 classes one called Gui and one called Listener. The code for
I hit the maximum url-patterns that one can have in the web.xml and I
I have more than one Event Listener that calls a specific function, and I
I have one XML request which I need to modify (to XML) and then
I have one repo hosted at https://github.com/aikiframework/json . On my local copy, I added
I am new JMS arena, I have created multiple message listeners but one listener
I am using jsf and spring together in web application. I have configured datasource
I have one activity class and a service with media player inside of it.
I have a web application that use Sring IoC framework. I use the Java
My application works as follows: I have one location listener to every activity My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.