What Is Custom Tag?
This section describes what is JSP custom tag. A custom tag can be define by the user through the JSP tag extension facility using a Java tag class.
What Is Custom Tag?
Custom Tag is an action tag defined by the user through the JSP tag extension facility.
It can be used to move JSP scripting code and information into a Java tag class, and invoke
it by an action tag that is linked to that class. There are two main advantages of using
- Repeatable JSP page logics and information can be simplified and centralized into a single tag.
For example, we can define a custom tag called <my:copyright/> for producing
the copyright information that need to be used on every page of a JSP application.
- Moving complex business logics from the JSP to a tag class, so the JSP page
author can concentrate on the presentation logics only. For example, we can define a
custom tag called <my:userList/> for producing a HTML table filled with a list of users.
The tag class will manage how to put each user into a row, and each user property
into a column.
I am sure that the functionalities provided by custom tags can also be archived by
using JavaBean and scripting elements together. But tags seem to be simpler to use
for many unsophisticated JSP page authors.
Last update: 2012.
Table of Contents
About This Book
JSP (JavaServer Pages) Overview
Tomcat 7 Installation on Windows Systems
JSP Scripting Elements
Java Servlet Introduction
JSP Implicit Objects
Syntax of JSP Pages and JSP Documents
JSP Application Session
Managing Cookies in JSP Pages
JavaBean Objects and "useBean" Action Elements
Managing HTTP Response Header Lines
Non-ASCII Characters Support in JSP Pages
Performance of JSP Pages
EL (Expression Language)
Overview of JSTL (JSP Standard Tag Libraries)
JSTL Core Library
►JSP Custom Tags
►What Is Custom Tag?
Creating and Using Custom Tags
My First Custom Tag - hy:hello
How Custom Tag Works
JSP Java Tag Interface
Custom Tag Attributes
Multiple Tags Working Together
File Upload Test Application
PDF Printing Version