JSP Directives

JSP Directives: JSP directives provides the instructions and directions to the web container about how to control the processing JSP page.

Syntax:

<%@ directiveName attributeName=”attributValue” %>

Types of JSP directives:

  • page directive.
  • include directive.
  • taglib directive.

Import Attribute Of JSP Page Directive

This attribute is used to import interface, classes or whole package. You can import more than one package separated by commas.

Syntax:

<%@page import=”value1,value2…”%>

welcome.jsp:

<%@ page import=”java.util.Date” %> 
<html>
            <head>
                        <title>import page directive example</title>
            </head>
            <body>
                        Current date: <%= new Date() %>
            </body>
</html>
Scroll to Top