after database checking this code will executed
the jsp page was displayed but the url is servlet url.
servlet page:
RequestDispatcher rd = request.getRequestDispatcher("/AddDept.jsp");
request.setAttribute("msg", "error");
rd.forward(request, response);
jsp page:
after body section
<% String msg=(String)request.getAttribute("msg");
if(msg=="success"){ %>
<div><script> success();</script></div>
<%} else if(msg=="error"){ out.println("inside"); %>
<div><script lang="javascript">success();</script></div>
<%} %>
my problem is the alert box is showing but url is servlet example: http://localhost:8084/project/addDept => actual url is http://localhost:8084/project/AddDept.jsp
thanks