Saturday, November 21, 2015

A simple custom tag

Defining a simple custom tag: To demonstrate the life cycle of a custom tag practically, I am creating a simple Tag class, its TLD file and a JSP page. This tag doesn’t do anything fancy, its purpose is just to let you understand how a custom tag works. Here is the Source code of the […]
Read Complete Post...

Tag Library Descriptor

Tag Library Descriptor: A Tag Library Descriptor (TLD) is a XML file crated by the tag programmer to associate custom tags to their Tag classes. With the help of a TLD file, a Tag programmer groups the logically related tags to a library. It is used by the Tag Processor to identify the Tag classes […]
Read Complete Post...

TagSupport class of Tag API

The TagSupport class: TagSupport is a helper class provided by Tag API. It implements IterationTag interface which is a sub interface of Tag. It is used as a super class by the custom tag classes. As an application programmer defines a Servlet by extending HttpServlet class similarly he/she can define a Tag by extending the […]
Read Complete Post...

Wednesday, November 18, 2015

Role of PageContext in custom tags

What is PageContext? PageContext is an interface of the JSP API. Implementation of it, is provided by server vendors. An object of type PageContext is created by the server for each request of a JSP page to store the references of the Servlet & JSP API objects which participate in the processing of the request. […]
Read Complete Post..

Tuesday, November 17, 2015

Tag life cycle methods

Tag life cycle: Tag life cycle describes how and when a tag object is created, initialized, and is used by the tag processor for processing a custom tag. Tag life cycle is defined by javax.servlet.jsp.tagext.Tag interface with the help of following methods: setPageContext(): It is the first method which is invoked by the tag processor […]
Read Complete Post...

Introduction to JSP Custom Tags

Introduction to JSP custom tags: Custom tags are application programmers’ defined actions which represent presentation logic as reusable components. The facility of defining custom tags makes the JSP extensible. To understand the use of custom tags, lets consider the following scenario. Let there be a web application in which 10 pages displays user data in […]
Read Complete Post...

Wednesday, October 28, 2015

JSP Page Directive

JSP page directive: The page directive in JSP is used by programmers to get the structure of the auto generated servlet modified according to their requirements. It has following syntax: Commonly used attributes of the page directive are: 1. import: This attribute is used to get the specified packages imported in the auto generated servlet […]
Read Complete Post...