You could have the same logic within a method to clear your JSP, servlets cache when you wanted to do so. Actually by calling appropriate session.invalidate(), will clear all session stored items for a particular session.
say i have a logout link and it is redirecting to lo-gout servlet
You can configure filters to intercept request/responses before reaching/coming from the servlet. So, upon clicking "logout" it is expected to go to servlet and you can configure a filter before it goes to the actual servlet.
But this has nothing to do with clearing cache. As Bear pointed out, you need to refer the link he provided.