Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not getting alert msg in jsp

 
narayana arya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic