I want to user HttpServletResponse object to compose a response that will tell the browser client to open a popup with some message - how can i do that?
Every Servlet response is basically an Http doc/snippet. So you could return a call to a javascript function that will be executed on the client side. The function can be passed in that Servlet response or it can be pre-included in the .js file.
just an example:
//servlet code
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.println("<script type=\"text/javascript\">");
out.println("alert('deadbeef');");
out.println("</script>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With