• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » JSP » JSP Directive

Jsp ElIgnored Example

By Dinesh Thakur

In this example we will explain about ElAttribute EL(Expression Language). As jsp used all the Expressions that are linked with EL attributes by default. Bt if user need to ignore them manually user has to change page directive ‘true’.

 

This is the main concept which we are discussing ignoring the ElExpressions. In the program that we present the condition is to concat the two strings with each other bt when in the program page directive will true it will ignore the expression of jsp function. The page directive has to be false that is by default in the jsp attribute. And we also use concat function in the program so far….

<%@ page isELIgnored=”false” %>

<%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c” %>

<html>

    <head>

         <title>&lt;isELIgnored&gt; In JSP</title>

   </head>

   <body>

        <br><h3 align=”center”>The Demo Of “isELIgnored Attribute” In JSP</h3></br>

        <c:set var=”jsp1″ value=”Jakarta”/>

        <c:set var=”jsp2″ value=”java”/>

        <c:choose>

        <c:when test=”${jsp1 eq ‘Jakarta’}”>

        <c:set var=”concat” value=”${jsp1}${jsp2}” />

        <h3 align=”center”><br><c:out value=”${concat}”></h3></br></c:out>

       </c:when>

         <c:otherwise>

            <h3 align=”center”>”${jsp1}”</h3>

          </c:otherwise>

      </c:choose>

  </body>

</html>

           

           

JSP Directive tags | Types of Directive tags

By Dinesh Thakur

Directive tags are placed inside the JSP page to provide message to the JSP container.

Directive tags have this syntax:

<%@ directive {attr=”value”}* %>. White space is optional after the ‘<%@’ and before ‘%>’. This syntax is easy to type. Directives do not produce any output into the current out stream. There are three directives: the page, include directives and taglib.

Directive tags are those tags of JSP which do not produce output into current out stream and are placed only for messaging to the JSP container.

We are going to discuss directive tags and their utilization like importing packages, error page configuration and getting implicit object exception.

Types of Directive tags

Directive tags affect the overall structure of servlet that is generated from the JSP. These tags are used to set global values such as class declarations, methods to be implemented, output content type, etc. These tags provide directions by generating equivalent Java code in Java equivalent servlet. These are three types of directive tags which are as follows:

1. page directive

2. include directive

3. taglib directive

Page Directive

This tag provides global information to the JSP program. The programmer can use page directive multiple times in a JSP page. The page directive used on any part of the JSP page is automatically applied to the entire translation unit. It is a good programming style to place the page directive at the beginning of the JSP page.

The syntax as follows:

<%@page attributes%>;

XML based syntax

<jsp:directive.page attributes/>

Include Directive

This tag is used to include the code of destination program to source JSP program. So the request given to source JSP program executes its code and the included code. The included directives add the text of the included file to the JSP page without any processing or modification. The included file can be static or dynamic.

Syntax of include directive:

<%@include file = “destination resouce/file name”%>

XML based syntax:

<jsp:directive.include file=”destination/file name”%>

The behaviour of include with respect to recompilation is container dependent, that means some servers recognize without recompilation and some do not.

Taglib Directive

The taglib directive in a JSP page declares that the page uses a tag library. It identifies the tag library using a URI and associates a tag prefix that differentiates the usage of actions in the library. If a JSP container implementation cannot locate a tag library description, then that results in fatal translation error.

The taglib directive tag is used to declare a custom tag library in a JSP page. The programmer creates his own tag to make Java code less JSP program. Xml syntax is not available for it. Syntax of taglib directive

<%@taglib uri=”some name” prefix=”unique name”%>

Primary Sidebar

Java Server Pages

Java Server Pages

  • JSP - Home
  • JSP - Advantages
  • JSP - Architecture
  • JSP - Life Cycle
  • JSP - Servlet Disadvantages
  • JSP - PrintWriter Vs JspWriter
  • JSP - Session Tracking
  • JSP - Stateless Protocol
  • JSP - Hidden Form Fields
  • JSP - Program Structure
  • JSP - Bill Discount Program
  • JSP - Scripting Elements
  • JSP - fn:length()
  • JSP - fn:split()
  • JSP - fmt formatNumber Tag
  • JSP - Servlet Communication
  • JSP - fn:replace()
  • JSP - fmt:parseNumber Tag
  • JSP - fmt:parseDate Tag
  • JSP - fn:substring()

Other Links

  • JSP - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2023. All Rights Reserved.