Taglib Directive

It defines a tag library and prefix for the custom tags used in the JSP page

JSP Synatx:

<%@ taglib uri="URIToTagLibrary" prefix="tagPrefix" %>

Examples

<%@ taglib uri="http://www.jspcentral.com/tags" prefix="public" %><public:loop>
.
.
.
.</public:loop>

<%@ taglib %>directive declares that the JSP file uses custom tags,names the tag library that defines them,and specifies theor tag prefix.
Here, the term custom tag refers to both tags and elements Because JSP files can be converted to XML, it is important to understand the relationship of tags and elements.A tag is simply a short piece of markup that is part of a JSP element.

A JSP element is a unit of JSP syntax that has an XML equivalent with a start tag and an end tag. An element can also contain other text,tags,or element. For example a jsp:plugin element always bhas astart tag and aend tag and may have aelement and aelement

you must use a<%@ taglib %>directive before you use the custom tag in a JSP file. you can use more than one<%@ taglib %>directive in a JSP file,but the prefix defined in each must be unique.
The technique for creating custom tags is describe in the JavaServer Pages Specfication for version 1.1.

Attributes

uri="URIToTagLibrary"

The Uniform Resource Identifier(URI)that uniquely names the set of custom tags associated with the named tag prefix.A URI can be any of the following:

● A Uniform Resource Locator(URI),as defined in RFC 2396,available at http://www.hut.fi/u/jkorpela/rfc/2396/full.html
● A Uniform Resource Name(URN),as defined in RFC 2396
● An absolute or relative pathname

prefix="tagPrefix"

The prefix that precedes the custom tag name,for example,public in. Empty prefixes are illegal.if you are developing or using custom tags.you cannot use the tag prefixes jsp,jspx,java,javax,servlet,sun,and sunw,as they are reserved by sun microsystems

Comments

Generates a comment, which has sent to the client.

JSP Synatx

<!--comment[<% = expression %>]-->

Example

<!-- This file displays the user login screen -->
Displays exactly the same comment in the viewable page source:
<!-- This file displays the user login screen -->

Example2

<!-- this page was loaded on<%=(new java.util.Date()).toLocaleString() %>--->
Displays in the page source:
<!-- This page was loaded on january 1,2000 -->

Description

An HTML comment in a JSP file is very similar to any other HTML comment.It documents the file and can be viewed in the page source from web browser.
The one different is that you can use an expression in an HTML comment in a JSP file.The expression is dynamic and is evaluated when the page is loaded or reloaded in the web browser. You can use any expression that is valid in the page scripting language.

JSP Syntax:

<%-- comment --%>


    <%@ page language="java" %>
    <html>
        <head><title>A Comment Test</title></head>
        <body><h2> Test of comments</h2>
        <% -- This comments will not be visible in the page source --%></body>
   
    
    </html>

Description

A Hidden comment markes text or lines That bthe JSP container should ignore. A hidden comment is useful when you want or"comment out" part of your JSP page.The JSP container does not process anything within the<%-- and --%>characters. A hidden comment except the closing --%> combination.if you need to use --%> in your comment, you can escape it by typing--%\>. « Privious Post » « Next Post » share on :        :  

Love to hear your Views / Guidance / Recommendations on this Post…

Explore the Technology World

Computer Programming Terminologies Computer Programming Terminology is a general word for the group of specialized words or meanings relating to Computer Programming, and also the study of such t ...Read MoreNew features in JDK 12 with IntelliJ IDEADeveloped by JetBrains (formerly known as IntelliJ) ,IntelliJ IDEA is a Java integrated development environment (IDE) for developing computer software. It is av ...Read MoreGoogle Pay API Implementation Demo for AndroidIn this youtube Channel by Android Developers ,Learn how to implement the Google Pay API for Android with just a few lines of code and how it works with your ex ...Read MoreUnit Testing in .NET Core and Azure Devops pipelineUnit testing is a software testing method by which individual units of source code, usage procedures,sets of one or more computer program modules together with ...Read MoreThe mind behind Linux & GIT : Linus TorvaldsLinus Torvalds transformed technology twice — first with the Linux kernel, which helps power the Internet, and again with Git, the source code management ...Read MoreTensorflow and deep learningWith Tensorflow ,deep machine learning transitions from an area of research into mainstream software engineering. ...Read MoreJava program to return all possible permutations from collection of distinct numbersexample of Java program to return all possible permutations from collection of distinct numbers ...Read MoreReal Time Analytics with Spring Application Development FrameworkSpring is the most popular application development framework for enterprise Java.Millions of developers use Spring to build simple, truly portable, fast and fle ...Read MorePath Setting in Java When an application is launched from command prompt Windows OS searches for the executable program in the current working directory. The prompt throws an error ...Read MoreFacebook | whatsapp|Github | Twitter | LinkedIn | Youtube| reddit About | Cookies-Policy | Disclaimer | Site Map | Contact

Call / Visit for New Batch

Services

Why Join Us

  • ➯ Free Demo Classes
  • ➯ No Registration Fee
  • ➯ Interview Questions
  • ➯ Study Materials
  • ➯ Softwares
  • ➯ Aptitude & Reasoning
  • ➯ Placement Assitance

Address

  • MyJava Training Institute ,
  • Plot No.243 , shop No 14 ,
  • Secnd Floor , Zone-II ,
  • M.P.Nagar , Bhopal,
  • Madhya Pradesh ( 462011 )
  • ☎  08871209400 , 7987028543
  • 🌐 www.myjava.in
FacebookGoogle +TwitterYouTube

MyJava - java Training Institute