Tags using in jsp

By: aathishankaran Emailed: 1768 times Printed: 2515 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

Tags using in jsp

     In this article we will learn about the various tags available in JSP with suitable examples. In JSP tags can be divided into 4 different types. These are:

    Directives: In the directives we can import packages, define error handling pages or the session information of the JSP page.
   Declarations: This tag is used for defining the functions and variables to be used in the JSP.
   Scriplets: In this tag we can insert any amount of valid java code and these codes are placed in _jspService method by the JSP engine.
   Expressions: We can use this tag to output any data on the generated page. These data are automatically converted to string and printed on the    output stream.
    Now we will examine each tags in details with examples.


Syntax of JSP directives is:

<%@directive attribute="value" %>

Where directive may be:

  • page: page is used to provide the information about it.
    Example: <%@page language="java" %> 
  • include: include is used to include a file in the JSP page.
    Example: <%@ include file="/header.jsp" %> 
  • taglib: taglib is used to use the custom tags in the JSP pages (custom tags allows us to defined our own tags).
    Example: <%@ taglib uri="tlds/taglib.tld" prefix="mytag" %> 

and attribute may be:

  • language="java"
    This tells the server that the page is using the java language. Current JSP specification supports only java language.
    Example: <%@page language="java" %> 
  • extends="mypackage.myclass"
    This attribute is used when we want to extend any class. We can use comma(,) to import more than one packages.
    Example: <%@page language="java" import="java.sql.*,mypackage.myclass" %> 
  • session="true"
    When this value is true session data is available to the JSP page otherwise not. By default this value is true.
    Example: <%@page language="java" session="true" %> 
  • errorPage="error.jsp"
    errorPage is used to handle the un-handled exceptions in the page.
    Example: <%@page language="java" session="true" errorPage="error.jsp"  %> 
  • contentType="text/html;charset=ISO-8859-1"
    Use this attribute to set the mime type and character set of the JSP.
    Example: <%@page language="java" session="true" contentType="text/html;charset=ISO-8859-1"  %> 

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


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 aathishankaran
Web Security Issues
The Web User's Perspective
Server-side plug-Ins
The best way to avoid security vulnerabilities with new server
JavaScript Security
Window Object
Working with Status Bar Messages
Retrieving a Portion of a String
Referencing Windows
Math Object
Frame Object
Document Object
Closing Windows
Built-in Object in Javascript
Textarea Object

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 )
What are the different scopes in JSP?
JSP Example to connect to MS SQL database and retrieve records
Form processing in JSP
Sending Email using JSP
Automatically Refreshing a JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: `java.net.BindException: Permission denied <null>:80
Click to Activate and Use this control
The JSP Program running first Time.
Embedding java codes in jsp sciptlets
Tags using in jsp
JSP pages in servlet
JSP Program for display Date
Protecting your website with a login page
The Advantages of Servlets Over “Traditional” CGI
Most Emailed Articles (in JSP)
What is JSP?
Declaring variable in JSP
Techniques for form editing
A Simple Servlet Generating Plain Text
An Example Using Servlet Initialization and Page Modification Dates
Text Object
The Basic Syntax Expression Language in JSP
Disabling Scriptlets in JSP using web.xml
The BodyTag Interface in JSP
What are the different scopes in JSP?
Sending Email using JSP
Using a DataSource from WebLogic in a JSP
Getting HTTP Request Headers in a JSP