A Basic JSP example



Introduction

JavaServer Pages allow you to create dynamic webpages using Java code.

<html>
<head>
    <title>A Simple JSP Page</title>
</head>
<body>
<pre>

This is template text; it is automatically written to the output
stream.

<hr>

<%-- This is a JSP comment --%>

<hr>

<%
    // This is a scriptlet; it contains Java code
%>

<hr>

The following is a JSP expression; it is used to emit dynamic
text to the output stream: 
The current date is <%= new java.util.Date() %>

<hr>

The following is a directive that includes other files:
<%@ include file="fragment.jsp" %>

</pre>
</body>

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.