Display pop up ( alert ) when submit
I have a situation where I need to submit the form and display an alert
message after the action completes. I am sending request from xyz.jsp and
after submit, xyz.jsp will be displayed back in the browser with modified
data.
My code in servlet looks as below.
public void doPost(......)
{
//process input value.
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.println("<script type=\"text/javascript\">");
out.println("alert('"+message+"');");
out.println("</script>");
RequestDispatcher rd = sc.getRequestDispatcher(/xyz.jsp);
rd.forward(request, response);
}
But when I submit, the pop up will not appear, but xyz.jsp will be loaded
in the browser.
Could anyone please help me to resolve the issue.
No comments:
Post a Comment