Java Server Pages (JSP)
Java Server Pages (JSP) is a server-side programming
technology that enables the creation of dynamic, platform-
independent method for building Web-based applications.
JSP have access to the entire family of Java APIs, including the
JDBC API to access enterprise databases.
Elements of JSP
The Scriptlet
A scriptlet can contain any number of JAVA language
statements, variable or method declarations, or expressions that
are valid in the page scripting language.
syntax of Scriptlet
<% code fragment %>
Example:
<html>
<head><title>Hello World</title></head>
<body>
Hello World!<br/>
<%
[Link]("Your IP address is " + [Link]());
%>
</body>
</html>
JSP Declarations
A declaration declares one or more variables or methods that
you can use in Java code later in the JSP file.
You must declare the variable or method before you use it in
the JSP file.
Syntax for JSP Declarations
<%! declaration; [ declaration; ]+ ... %>
Example for JSP Declarations −
<%! int i = 0; %>
<%! int a, b, c; %>
<%! Circle a = new Circle(2.0); %>