Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

call java method using onclick

843838Jul 19 2006 — edited Jul 21 2006
Here�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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2006
Added on Jul 19 2006
10 comments
2,878 views