declaration

<%@ page import="java.util.*" %>
<HTML>
<BODY>
<%!
    Date theDate = new Date();
    Date getDate()
    {
        System.out.println( "In getDate() method" );
        return theDate;
    }
%>
Hello!  The time is now <%= getDate() %>
</BODY>
</HTML>

===========================

To add a declaration, you must use the <%! and %> sequences to enclose your declarations,
原文地址:https://www.cnblogs.com/greencolor/p/2329085.html