Tags using in jsp

By: aathishankaran Emailed: 1649 times Printed: 2116 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.

DIRECTIVES

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

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 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 )
JSP Example to connect to MS SQL database and retrieve records
JSP Program for display Date
What are the different scopes in JSP?
Sending Email using JSP
Uploading an Image to a Database using JSP
JSP Alert Example
Writing your first JSP page
JSP CheckBox Example
Arithmetic Evaluation Using the Expression Language in JSP
Tags using in jsp
Example Using Initialization Parameters
Basic Servlet Structure
Enable/Disable Scripting Elements in JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: `java.net.BindException: Permission denied <null>:80
Retrieving a Portion of a String
Most Emailed Articles (in JSP)
Tag libraries
What is JSP?
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: `java.net.BindException: Permission denied <null>:80
What is JSP?
Click to Activate and Use this control
Tags using in jsp
Introduction to JSP expression language
Disabling Scriptlets in JSP using web.xml
Cookies using JSP or Java Bean
Closing Windows
Frame Object
Retrieving a Portion of a String
Getting HTTP Request Headers in a JSP
Syntax For JSP Declaratives
JSP Program for display Date