Home Tutorial Jsp Page Directive attribute - import


Share on Google+Share on Google+
Page Directive attribute - import
Posted on: November 29, 2012 at 12:00 AM
This tutorial contains description of import attribute of page Directive.

Page Directive attribute - import

This tutorial  contains description of import attribute of page Directive.

import  Attribute :

This attribute of page directive imports single package and classes or list of packages and classes . For multiple import you can use comma(,) for separation. By default, jsp container automatically imports java.lang.*, javax.servlet.*, javax.servlet.jsp.*, and javax.servlet.http.*.

Syntax :

<%@ page import="java.sql.*,java.util.*" %>

Example :

importAttribute.jsp -

<%@page import="roseindia.ImportExample"%>
<title>Import Attribute</title>

<font size="10" color="orange" style="border-bottom-style: dashed;"> 
ImportExample ex = new ImportExample();

ImportExample.java -

package roseindia;

public class ImportExample {
	public String display() {
		return "Hello Roseindia";

Output :


Related Tags for Page Directive attribute - import:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 29, 2012

Recommend the tutorial

Advertisements Advertisements