Define JSP directives.
-The page directive
-The include directive
-The taglib directivePage directive:
The page directive allows to apply different attributes that is to be added to a JSP. These attributes gives special processing information to the JSP engine which allows the way of processing JSP pages. The following are the various page directives that are used in JSP.
The syntax of any page directive is : <% @page optional parameters …..> , where optional parameters can be any one of the above directives.Include directive:
The include directive is used to insert a static file which will parse the JSP elements. The syntax is : <% @include file = jsp file %>
<% @include file=login.jsp %>
The include file can be a static file such as HTML or a dynamic page such as JSP file. If the file is a JSP page , the JSP elements are parsed and their results are included in the current JSP page.Tag Libraries:
JSP technology supports the development of reusable components called custom actions. A custom action is invoked by the custom tag. A tag library is a set of custom tags. Examples are form processing, accessing databases and other enterprise services such as email , flow controls etc. JSP tag libraries are used for web developers who are focused on presenting the issues.
The following are the some of the features of JSP custom tags:
•The custom tags can be customized through passing the attributes from the calling page.
•They can be accessed by all the available objects of JSP page.
•The response of the generated page can be modified by custom tags by calling the page.
•They can create and initialize a java bean component in order to communicate each other.
•Complex interaction can be done with JSP page by nesting the custom tags..
What are JSP directives?Answer
JSP directives are used to set global values like class declaration, content type etc. have scope for entire JSP file. There are 3 directives that can be used in JSP.
Page directive is used to define page attributes.
This directive is used to include content of the file in the current .jsp page.
Taglib, JSP tag extension, provides a way of encapsulating reusable functionality on JSP page.
Explain the types of JSP directives.
There are three directives in JSP. They are
• Page directive
• Include directive
• Taglib directive
All the page directives begin with <% @ and end with %>Page Directive:
Page directive specifies the instructions which applies to the entire source file , to the JSP engine.
<%@ page language="java" import="java.util.*>Include Directive:
Include Directive includes a static web page in a JSP file.Taglib Directive:
Taglib Directive permits a page to be used as a custom tag and also defined the tag library.
<%@ taglib uri=”uritaglibrary” prefix=”tagprefix” %>