call java method using onclick
843838Jul 19 2006 — edited Jul 21 2006Here�s my situation. I have a JSP that contains hyper links, and I want to log what links get clicked on to a file. Initially, I created a function that would get executed anytime the links were clicked on. I used an onclick=�functionName()� inside of my <A> tag. Inside of the function, I embedded the java code to perform calls to the methods to write to the file. The problem is that whether or not a link was clicked on, it always executed the java code to write to the file. Next, I tried to call the java method directly from the onclick. For example onclick=�obj.methodName()�. That didn�t work. It displayed my JSP with an error stating �Syntax error�. Does anyone know how to get around this problem?