CodesJava

Easy learning with example program codes

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…”%>

Example:

welcome.jsp

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

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>welcome.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 6
 
Download this example.
 
Next Topic: Session attribute of JSP page directive with example.
Previous Topic: JSP directives with example.

Related Topics:

import attribute of JSP page directive with example.
Session attribute of JSP page directive with example.
buffer attribute in JSP page directive with example.
autoFlush attribute in JSP page directive with example.
contentType attribute in JSP page directive with example.
isErrorPage and errorPage attribute in JSP page directive with example.
isThreadSafe attribute in JSP page directive with example.
language attribute in JSP page directive with example.
info attribute in JSP page directive with example.
JSP include directive with example.
JSP taglib directive with example.

 



Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap