-
FEATURED COMPONENTS
First time here? Check out the FAQ!
So I see that you specify in the web.xml file based on documentation:
<listener>
</listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Does the listener have to be web.context.ContextLoaderListener? Are there other listeners that are available for use besides the one shown above? If I created my own listener in my own package test.package.MyCustomListener.java, would I be able to use that?
Hi Tessla,
Sure you can use your own listener. listener classes are used to listen to web application events. For example in this case spring's ContextLoaderListener is responsible for start up and shut down Spring's root WebApplicationContext. You could have your own listener that implements javax.servlet.ServletContextListener or javax.servlet.http.HttpSessionListener
First question, is ContextLoaderLister what is specifically used for "Spring Web Flow" and does not need to be used to retrieve Spring Beans?
Second, is the listener able to be used in the web.xml file required to use WebApplicationContext and implements either javax.servlet.ServletContextListener or javax.servlet.http.HttpSessionListener?
Reason why I ask is because if a Spring project was made not using web, or any web flow usage, if it would be possible to use an existing listener that does not implement ServletContextLisener or HttpSessionListener?
Hi gpan,
>> is ContextLoaderLister what is specifically used for "Spring Web Flow" and does not need to be used to retrieve Spring Beans?
You might need to dig into spring documentation for this.
>>is the listener able to be used in the web.xml file required to use WebApplicationContext and implements either javax.servlet.ServletContextListener or javax.servlet.http.HttpSessionListener?
First of all make sure what is the purposeof your listener. If you implement ServletContextLisener you are listening to servlet loading events and if you are implementing HttpSessionListener you are listening to http session events.
Asked: 2010-10-12 23:42:18 +0800
Seen: 349 times
Last updated: Oct 13 '10