JSP TUTORIAL
First Sample Jsp Program
A JSP page is basically a web page with traditional HTML and bits of Java code. The file extension of a JSP page is ".jsp" , and that tells the server that this page requires special handling that will be accomplished by a server. Here is a simple example:
Sample 1: date.jsp
<HTML>
<HEAD>
<TITLE>JSP Example</TITLE>
</HEAD>
<BODY BGCOLOR="ffffcc">
<CENTER>
<H2>Date and Time</H2>
<% -- (1)
java.util.Date today = new java.util.Date();
out.println("Today's date is: "+today);
%> -- (2)
</CENTER>
</BODY>
</HTML>
|
(1) - Beginning of jsp program scriptlet
(2) - End of jsp program script let
When above jsp executed and sent to browser, browser will show the following screen
Date and Time
Today's date is: Wed Aug 12 10:09:25 EDT 2002
|
|
|
|
|
|