JSP Syntax
JSP looks very much like HTML. In fact, any legal HTML document is also a legal JSP. JSPs allow you to include dynamic content using the following syntactic elements.
<% . . . %>: Executes the Java code inside the delimiters.
-
<%= . . . %>: Evaluates the Java expression and displays the results on the page.
-
<%! . . . %>: Allows you to declare page-level variables.
The JSP Syntax chart (http://java.sun.com/products/jsp/pdf/card11a.pdf) provides a handy reference to JSP syntactic elements.
Here is a simple JSP page that displays the current date and time:
<html>
<head><title>Current Date and Time</title></head>
<body>
Hello, the current time is <%=new java.util.Date()%>
</body>
</html>
Copyright (c) Jason Voegele. All rights reserved.