Javaserver Pages





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Tutorial
Introduction Introduction
Installing JDK-Windows Installing JDK-Windows
Installing JDK-Linux Installing JDK-Linux
Installing Tomcat Installing Tomcat
Simple Program in JSP Simple Program in JSP
Pre-defined Variables Pre-defined Variables
Syntax of Tags Syntax of Tags
JSP Expression Language JSP Expression Language
JSP EL Operators JSP EL Operators
EL Implicit Variables EL Implicit Variables
Scopes Scopes
Using Arrays Using Arrays
Methods Methods
JSP Elements JSP Elements
Including Beans Including Beans
JSTL Tags JSTL Tags
Custom Tags Custom Tags
Session Session in JSP
Handling Cookies Handling Cookies
JSP Application Structure JSP Application Structure
Configuring web.xml Configuring web.xml
Tomcat Configuration Tomcat Configuration
JSP Examples JSP Examples
Forums Ask Your Doubts
Feedback Feedback
 




Using TLD files


Tutorials Jsp

Topic

How to use Tag Library Descriptor file in JSP?



Explanation

In a JSP page the classes to be used are included from a "tld" file using the tags. Tags with the "prefix" of a paticular tld file, along with the class name are used in a JSP page.

Example:
    <%@ taglib  uri="WEB-INF/tlds/mytag.tld" prefix="sample" %>
    <html>
    <head>
       <title>Your Standard Hello World Demo</title>
    </head>
    <body bgcolor="#ffffff">
    <hr/>
       <sample:hello name="hello1"/>
       <sample:enc name="encrypt1"></sample:enc>
    <hr/>
    </body>
    </html>
Result:
    Welcome hello1
    Your Encrypted Password is=encrypt1c3a6478ff5ff7a243a53251ea5faf5

In the above Tag Library Descriptor example, the file "uri="WEB-INF/tlds/mytag.tld"" point to the tag library "mytag.tld". The prefix "sample" is used to refer this tag library. To display a "Hello1" message the class "Hello.java" is included in the JSP using this code "<sample:hello name="hello1"/>". The encrypted value of the password is displayed using the "Encrypt.java".








A Note
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.


Other Links

web hosting