Question: First I would like to note that I'm quite a beginner in using MATLABalthough I have some idea of syntax. I am working on a project trying to map the displacement of a particle in the environment. I have already manipulated all the data so it's all down to estetics. 
So basically I have two matrices 12 by 19 by 15, in which the coordinates (lat, long) of the particles are and the third dimension are timesteps. So the location of a particle changes through time. Now I wish to plot this in a way that at the first time step each element (so 12 by 19 although there are quite a few zeros and NaNs in the array) has it's own color that doesn't change in the next time step. This way you could track the movement of the particle. Note that I am operating with two matrices (one for latitude and the other for longitude, giving the location of the particle). So the plotting looks something like this

```
for it=1:nt
    plot(lat(:,:,it), long(:,:,it), 's'); hold on; 
end

```

It would also be nice if a connector line would be drawn in each succesive time step between the previous location and the new one. 

I am having problems with this because when I assign the color in `plot()` all the elements get their own color. Also when I try to draw lines, all elements in a time step get connected to each other and it's all just a big mess. I can do for only one particle, but if I introduce many it doesn't work.

Answer: 
`org.springframework.web.context.ContextLoaderListener` is a class from Spring framework. As it implements the `ServletContextListener` interface, the servlet container notifies it at startup (`contextInitialized`) and at shutdown (`contextDestroyed`) of a web application.

It is specifically in charge of bootstrapping (and orderly shutdown) the Spring ApplicationContext.

Ref: javadoc says:

> 
> Bootstrap listener to start up and shut down Spring's root WebApplicationContext. Simply delegates to ContextLoader as well as to ContextCleanupListener.
> 
> 
> 

`org.springframework.web.context.request.RequestContextListener` is another class from same framework. Its javadoc says:

> 
> Servlet 2.4+ listener that exposes the request to the current thread, through both LocaleContextHolder and RequestContextHolder. To be registered as listener in web.xml.
> 
> 
> Alternatively, Spring's RequestContextFilter and Spring's DispatcherServlet also expose the same request context to the current thread. In contrast to this listener, advanced options are available there (e.g. "threadContextInheritable").
> 
> 
> This listener is mainly for use with third-party servlets, e.g. the JSF FacesServlet. Within Spring's own web support, DispatcherServlet's processing is perfectly sufficient.
> 
> 
> 

So it is normally not used in a Spring MVC application, but allows request or session scoped bean in a JSF application using a Spring ApplicationContext
Listeners, in general, are a way for the container to notify your app of events, instead of just web requests.

For example, to be notified when a session is going to time out, you'd extend HttpSessionListener and implement the sessionDestroyed() method. The container would then call that on expiration of the session and you could log it alongside the login time for that user.

For ContextLoaderListener, this lets you kick off non-web related parts of your app, that you want on container startup, instead of waiting on someone to hit one of your spring components. It is using the context-param contextConfigLocation set earlier in your web.xml to know what to start. 

For RequestContextListener, you get notified of request creation and deletion .

Whether they're necessary depends on the architecture of your app.