Tag Libraries in JSP

By: Sathya Narayana Emailed: 1645 times Printed: 2155 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

The syntax for using tag libraries is similar to that for the standard actions except of course that the tag names and attributes are defined in the tag library itself rather than by the JSP standard. Each tag library is associated with a prefix by using the taglib directive to map the prefix to a URI identifying the tag library. For example, using the Jakarta Taglibs project's request tag library (http://jakarta.apache.org/taglibs/doc/request-doc/intro.html) looks like this:

<%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0" prefix="req"
%>
Within the JSP, you can then use tags from the library by using the prefix defined in the taglib directive and the tag's name. For example:

<req:attributes id="loop">
Name: <jsp:getProperty name="loop" property="name"/>
Value: <jsp:getProperty name="loop" property="value"/>
</req:attributes>

You can set up the mapping between a particular URI (as used in the taglib directive) and the tag library descriptor in one of two ways. In JSP, it's possible to package tag libraries so that the mapping is automatic, based on settings contained in the tag library descriptor file. Alternatively, you can make an entry in the web.xml file to map a URI to a tag library descriptor file:

<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/request-1.0</taglib-uri>
<taglib-location>/WEB-INF/request.tld</taglib-location>
</taglib>


JSP Home | All JSP Tutorials | Latest JSP Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Sathya Narayana
Querying Data with the JSTL in JSP
Deleting Data in MySQL
Modifying data and using WHERE clause in MySQL
Querying the Database in MySQL
Inserting Data into Tables in MySQL
Changing the Structure of an Existing Table in MySQL
The Exception Object in JSP
The Application Object in JSP
The Session Object in JSP
The Out Object in JSP
The Response Object in JSP
The Request Object in JSP
Tag Libraries in JSP
Scriptlets and Expressions in JSP
Declarations in JSP

More Tutorials in JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: `java.net.BindException: Permission denied <null>:80
JSP Alert Example
JSP CheckBox Example
Uploading an Image to a Database using JSP
Uploading a file to a server using JSP
A JSP page that gets properties from a bean
The page Directive in JSP
The taglib, tag, include, attribute and the variable Directive in JSP
Declarations in JSP
Scriptlets and Expressions in JSP
Tag Libraries in JSP
The Request Object in JSP
The Response Object in JSP
The Out Object in JSP
The Session Object in JSP

More Latest News
Most Viewed Articles (in JSP )
JSP Example to connect to MS SQL database and retrieve records
The Request Object in JSP
What are the different scopes in JSP?
JSP Alert Example
JSP CheckBox Example
Disabling Scriptlets in JSP using web.xml
Sending Email using JSP
Embedding java codes in jsp sciptlets
Combining Scriptlets with HTML
Automatically Including Preludes and Codas in JSP
Calling JSP from a batch file
Deploying an Individual JSP on Tomcat
Using a DataSource from WebLogic in a JSP
Embedding a QuickTime movie in a JSP
Tags using in jsp
Most Emailed Articles (in JSP)
Steps to get a Free SSL certificate for your Tomcat
What is JSP?
Retrieving a Portion of a String
Tag libraries
Tags using in jsp
Closing Windows
Getting HTTP Request Headers in a JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: `java.net.BindException: Permission denied <null>:80
Click to Activate and Use this control
Radio Object
Math Object
What is JSP?
Cookies using JSP or Java Bean
Built-in Object in Javascript
Frame Object