JSP Directive tutorial for Java Beginners

Directive is a type of Statement which can be used to give instruction to container about doing something special at @ page transalation time.

Directive can be divided in three types

  • Page
  • Include
  • Taglib

Page Directive

Syntax of Page Directive

<%@ page import="com.jbt.*"%>


Uses of Page Directive

Import Package

Page directive can be used to import single or double package.

Import Single Package

<%@ page import="com.jbt.*"%>

         Hello! <%= method() %>


Import Multiple Package 

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

       Hello! <%= method() %>. Time is <%new Date()%>


Taglib Directive

This directive is used to define tag libraries available to JSP.

Syntax of taglib Directive

<%@ taglib tagdir= "" prefix="" %>

 Uses of taglib Directive

taglib directive can be useful in case of Custom tags.

By | 2012-10-20T16:24:20+00:00 October 20th, 2012|JSP|0 Comments

About the Author:

Leave A Comment