This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes not getting alert msg in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "not getting alert msg in jsp" Watch "not getting alert msg in jsp" New topic
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
 
Similar Threads
in jsp run script
not able to redirect to html file from a jsp
Javascript code inside JSP (error in flushing)
why parameter cause problem ?
problem in Struts Validation