I wouldn't do that in a page change. You can eiher do it at the end of the doView () etc. method of the portlet, or register a session listener that clears the reference when the session gets destroyed.
But I agree: a page change listener could be an interesting feature. Anybody with some real use cases for it ?
Thanx for reply.
Current I use HttpSessionBindingListener.
I'm having a statefull session object which is used for searching. I combine the power of Lucene with EJB3 persistance. And I need to 'remember' some of the stuff that was used. But when the user leaves this search page I discard the session bean - with its persistance context and my statefull data.