I have a jsp file which has a submit button. On clicking this the call goes out to a different angular app. I want to log which user is clicking the button. For this I am thinking of calling a javascript function. Inside the javascript function callJSFunction() I want to pass the username of the user and call a java function. Inside the java function I need to store the user details in th db. My question is how can I call a java method (for logging) from the javascript. I am sure this a common use case for logging information in jsp. I am not sure how to achieve this? Any help is greatly appreciated.
<A class="gridlink1" id="portal"
title="Go to portal for <%= StringEscapeUtils.escapeHtml(resultBn.getName()) %>"
HREF="<%= resultBn.getLink() %>" onclick = "callJSFunction()"> <%=resultBn.getID()%>
</A>
function callJSFunction(){
alert("hello"); //palceholder
}