| Author |
not getting alert msg in jsp
|
narayana arya
Greenhorn
Joined: Dec 12, 2005
Posts: 12
|
|
Hi here i am unable to get alert message in my jsp file. could you explain me why this alert msg is not executing.(AFTER ALERT I AM REDIRECTING TO ANOTHER PAGE ) (it is not giving any err) if i dont redirect then the msg is coming but when i redirect it is not coming how and why??? 4ex the code is like: <% ... pst.executeUpdate(); out.print("<script>alert('Record Updated Successfully');</script>"); pst.close(); response.sendRedirect("anotherPage"); %> could anybody suggest me <b> how should i get alert msg before redirecting a page </b>
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
It looks like you don't have a firm grasp on what code gets executed on the server and which gets executed in the user's browser. In this case, the redirect happend before any of the scripting code was sent to the browser. The following article by this forum's esteemed bar-keep should help you. http://www.javaranch.com/journal/200510/Journal200510.jsp#a1 [ January 11, 2006: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: not getting alert msg in jsp
|
|
|