use OnClick with caution

JSP Code :

<a href="abc.jsp" onclick='’>LOGOUT

The above statement gets converted to Servlet CODE :

out.write("<a href="abc.jsp" onclick='");




What ever scriplet you write in onclick, will get executed every time the JSP is called. Not only on onclick as can be wrongly assumed.

0 Replies to “use OnClick with caution”

  1. Yep yep yep, just figured it out, it's better to simply do a small doGet servlet with this code:


    I was trying the other way because I tought that making a sevlet just for logging out was ridiculous but here I am.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.