<!--File jsp004.jsp
02/12/00
Illustrates scriptlets.

Access http://localhost:8080/jsp004.jsp to run 
this JSP file in the Sun jswdk-1.0.1 reference 
implementation of jsp. 
-->

<html>
  <body>

    <%-- Some JSP declarations follow --%>
    <%! int a = 100, b = 2, c; %>
    <%! java.util.Date myDate; %>


    a = <%= a %><BR>
    b = <%= b %><BR>

    <%-- scriptlet follows --%>
    <% c = a/b; %>

    c = <%= c %><BR>

    <%-- scriptlet follows --%>
    <% myDate = new java.util.Date(); %>
    The date is <%= myDate %><BR>

    <%-- two scriptlets follow --%>
    <% for (int i=0; i<11; i++) { %>
      <br> 
      <%= i %>
    <% }//end for loop %>

  </body>
</html>


Figure 1