Jsp Format


The generated JSP codes contains five parts:

Please don't change/modify the JSP Header and JSP End. Otherwise, the Jsp page will throw error.

Here is a sample for explaining the format of the generated Jsp file:

<%
Dim intLoop

Dim strTemp

strTemp = "Format"

' Start the loop telling it to loop from 1 to 5 incrementing
' I by one (which is the default) on each pass.
'
' ie. this would have done the same thing:
' For intLoop = 1 To 5

For intLoop = 1 To 5 Step 1
' Output our HTML and text using the value of I as
' the FONT TAG's SIZE attribute.
%>
<FONT SIZE="<%= intLoop %>">Hello World</FONT><BR>
<%
Next ' Bounce back to the top of the loop
Call mySub(1 , 2)

Sub mySub(p1 , p2)

  Response.Write p1
  Response.Write intLoop
  Response.Write p2

End Sub
%>


It will be converted into following JSP codes:

Description Jsp Codes
Jsp HEADER: Initializes the page. Do not change this code.

<%@ page import="jasp.buildin.*, jasp.vbs.*, jasp.util.*" %>
<%@ page extends="jasp.servlet.JspBase" %>
<%
try {
jspinit(request,response,application,out);
%>

Variables Block: Initializes the general variables(page scope) and defines the local variables.

<%
String strtemp = "";
/* initialize variables. */
intloop = 0;
/* initialize variable end */
%>

Body Block: Contains the HTML block and the code generated from the original ASP command scirpt.

<%
strtemp = "Format";
//Start the loop telling it to loop from 1 to 5 incrementing
//I by one (which is the default) on each pass.
//
//ie. this would have done the same thing:
//For intLoop = 1 To 5
for(intloop = 1; intloop <= 5; intloop += 1){
//Output our HTML and text using the value of I as
//the FONT TAG's SIZE attribute.
%>

<FONT SIZE="<%= intloop %>">Hello World</FONT><BR>
<%
}
//Bounce back to the top of the loop
mysub(1, 2);
%>

Declare Block: Declares the general variables and subroutine etc.

<%!
int intloop;
public void mysub(int p1, int p2) throws Exception {
   Response.Write(p1);
   Response.Write(intloop);
   Response.Write(p2);
}
%>

Jsp End: Ends current Jsp Page. Don't change this codes.

<%
End();
} catch(Exception ex) {
printStackTrace(ex);
}
%>