| Author |
How to stop the execuation of jsp flow
|
Parshuram Walunjkar
Ranch Hand
Joined: Jan 02, 2002
Posts: 31
|
|
<% boolean flag ; // Some java execution and set the value of boolean variable flag = true; if(flag) { %> <script> alert(" Here I want to stop"); history.back() </script> <% } // Some java code to be execrated // // ////// System.out.println(" some printing statement "); %> This is my sample jsp code. If the variable flag is true then I want the alert message and execution to be stopped. But actually this is not occurred. First the SOP will print and then at lastly the alert will occur. Why this happens.?
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
Looks to me like the entire JSP executes and sends a page, no matter what the flag is. Why not finish off the page and execute return if the flag is true. Bill
|
Java Resources at www.wbrogden.com
|
 |
Nicolas Brasseur
Ranch Hand
Joined: Nov 09, 2001
Posts: 45
|
|
You should first consider how JSP pages are treated by the web container (parsed, translated into a java servlet source file, compiled, instanciated, ...). you should also consider that you are mixing JSP tags (that will become java code executed on the server) with Javascript code (that will be executed on the client-side) ... Whatever ... looking at your code I think adding a return should solve your problem ... Nicolas
|
<a href="http://www.javablackbelt.com/?utm_source=javaranch&utm_medium=signature&utm_campaign=Forum%2BBuzz" target="_blank" rel="nofollow">BlackBeltFactory Communtiy</a> founder - Building better developers<br /><b>Free</b> courses and mock exams
|
 |
 |
|
|
subject: How to stop the execuation of jsp flow
|
|
|