File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes How to stop the execuation of jsp flow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to stop the execuation of jsp flow" Watch "How to stop the execuation of jsp flow" New topic

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;
alert(" Here I want to stop");
// 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

Joined: Mar 22, 2000
Posts: 13035
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.
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 ...


<a href="" target="_blank" rel="nofollow">BlackBeltFactory Communtiy</a> founder - Building better developers<br /><b>Free</b> courses and mock exams
I agree. Here's the link:
subject: How to stop the execuation of jsp flow
It's not a secret anymore!