Scripting elements manipulate objects and perform computations. The character sequence that precedes a scripting element depends on the element’s type: <% for a scriptlet, <%= for an expression, and <%! for a declaration. Scriptlets, expressions, declarations, and server-side comments are all closed with the sequence %>.
A scriptlet contains a code fragment valid in the page-scripting language (usually Java, but other languages can be defined in the page directive):
<% cart.processRequest(request); %>
An expression contains an expression valid in the page-scripting language:
Value="<%= request.getParameter("amount") %>"
A declaration declares variables or methods valid in the page-scripting language:
<%! Connection myconnection; String mystring; %>
You can add two types of comments to a JSP file:
HTML comments optionally contain an expression. They are sent to the client and can be viewed in the page source:
<!-- Copyright (C) 2002 Acme Software -->
Hidden comments document the source file and are not sent to the client:
<%-- Add new module here --%>
To insert a comment, type it in the Source view.