I am just elaborating Bear's answer. You can call a JS function on your link. Have a FORM tag in your HTML whose action should be your
servlet. In this function do a FORM_NAME.submit(). This will invoke your servlet, now you can invalidate session happily
Thanks
Abhishek.