I have tried following java code snippet ....but it doesn't work.Also i want func() to be activated only after href url is executed. Kindly help me with it.Thanks :)
stringBuilder.append("<a href=\"https://google.com\" onclick=\"myfunc(){ <%= func() %> }\" >");
stringBuilder.append("Click here</a>");
public static void func() {
System.out.println("Print something");}