I am new to web development. I have an external JavaScript file which has a function to show a prompt with error details. I need to pass the error message to the function. I
You can achieve similar kind of behavior by using following method. While sending response itself you can provide JS events.
PrintWriter out = response.getWriter(); out.println("");
So when you click on Search button, search record method of JS will be called.