Share on Google+Share on Google+

Page Directive attribute - import

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 -

<[email protected] import="roseindia.ImportExample"%>
<title>Import Attribute</title>

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

package roseindia;

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

Output :



Posted on: November 29, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.


Advertisement null