You can use the Ajax call to do this. Now that the HTML object is clicked, call java-script. Then in JavaScript make the servlet Ajax call something like this
$.get("Query?ID="+id ,function(RespValue) { }
Here Query is my servlet mapping defined in web.xml, and Id is the parameter I pass, you can send several parameters. and RespValue is the response value returned from the servlet. In servelt write the Get Get method and execute your Java code. If you want to return some value, use the function (RespValue), and then delete it.
source share