JSP combines HTML/XML with nuggets of JAVA
code to produce dynamic web-page. For JSP, servlets are the foundation.
Normally web page contains static data. With JSP, we separate static and
dynamic and insert dynamism into a web page. Beans are used to create your own
custom tags.
Static data and HTML data are stored on the
disk in .dat file. Number in the first line of the .dat file shows the size of
the array which is created for the HTML data. First _jspx_init is called which
opens .dat with static text. _jspx_init uses function readObject to read
contents of the .dat file into array_jspx_html_data. Then jspservice method is
called.
In JSP page, there are 3 types of scripting
elements: expression, declaration, scriptlets.
HTML with
JSP:
<%@ page language="java"
%>
<html>
<head>
<title> Simple
JSP Example</title>
</head>
<body>
<% for(int i=1;
i<=4; i++){%>
<H<%=i%>>Hello
</H<%=i%>>
<%}%>
HI
</body>
</html>