Hi

My jsp does not seem to run in the order I would expect ..

<%@ include file="/Site-English/Common/progressWindowInsert.html" %>
	<script language="javascript" type="text/javascript">
	    alert("do this");
             showProgressWindow();
	</script>
<%
System.out.println("print out this line  !!");   %>

The System.out.println commmand is written before I respond to the alert. Any explanations would be much appreciated.

The System.out.println is run on the server side when the Web Server detects that someone has requested for your JSP page.
Following is in brief the lifecycle of a JSP page:-

When a request is mapped to a JSP page, it is handled by a special servlet that first checks whether the JSP page's servlet is older than the JSP page. If it is, it translates the JSP page into a servlet class and compiles the class. During development, one of the advantages of JSP pages over servlets is that the build process is performed automatically.

Source:http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro4.html
The servlet generates the HTML code (inclusive of your Javascript) which should be displayed and sends it to your browser. The browser is the one that actually runs your Javascript code which shows the alert box, hence the message is printed on the console even before you respond to the alert box.
In fact a simple way to confirm this is by viewing the source of your webpage from the browser (Ctrl + U in firefox), you will notice that none of your java code is present, only the generated HTML and client side Javascript.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.