Explain any two page directive in JSP with example.
Page Directive
-
The page directive defines attributes that apply to an entire JSP page.
-
You may code page directives anywhere in your JSP page.
-
By convention, page directives are coded at the top of the JSP page.
-
Syntax : <%@page attribute="value" %>
Attributes of JSP page directive
-
import
-
Used to import class, interface or all the members of a package
-
Example : <%@ page import="java.util.Date" %>
Today is: <%= new Date() %>
-
contentType
-
The contentType attribute defines the MIME type of the HTTP response. The default value is "text/html;charset=ISO-8859-1"
-
Example : <%@ page contentType=application/msword %>