Academic Tutorials

English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting

JSP Tutorial
JSP Introduction
JSP Architecture
JSP Environment
JSP First Page
JSP Tags
JSP Session
JSP Implicit Object
JSP Create Form
JSP Summary

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
Apple Script
PL/SQL Tutorial
SQL Server
.NET (dotnet)
.Net Mobile
C# : C Sharp
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Assembly Language
Forth Programming
Lisp Programming
Data Warehousing
CGI Programming
Emacs Tutorial
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Operating System
Software Testing
SAP Module
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Financial Accounting
Managerial Accounting
Network Sites

JSP Tags

Previoushome Next

Using JSP tags

  • Declaration tag
  • Expression tag
  • Directive tag
  • Scriptlet tag
  • Action tag

Declaration tag

Declaration tag ( <%! %> )
  • It allows the developer to declare variables or methods.
  • Start with <%! and End with %>
  • Code placed inside this tag must end in a semicolon ( ; ).
Declarations do not generate output so are used with JSP expressions or scriptlets.
For Example,

private int counter = 0 ;
private String get Account ( int accountNo) ;

Expression tag

Expression tag ( <%= %>)

Expression tag allow the developer to embed any Java expression and is short for out.println().
A semicolon ( ; ) does not appear at the end of the code inside the tag. show the current date and time.

Date : <%= new java.util.Date() %>

Directive tag

Direcitve tag ( <%@ directive...>)

A JSP directive gives special information about the page to JSP Engine.

Three main types of directives are:
1)     page - processing information for this page.
2)     Include - files to be included.
3)     Tag library - tag library to be used in this page.

Directives do not produce any visible output when the page is requested but change the way the JSP Engine processes the page.

e.g.,you can make session data unavailable to a page by setting a page directive (session) to false.

1. Page Directive

This directive has 11 optional attributes that provide the JSP Engine with special processing information. The 11 different attributes with a brief description is decribe in table given below:

Language Which language the file uses. <%@ page language = "java" %>

Superclass used by the JSP engine for the translated Servlet.

<%@ page extends = "com.taglib... %>

Import all the classes in a java package into the current JSP page. This allows the JSP page to use other java classes.

<%@ page import = "java.util.*" %>

oes the page make use of sessions. By default all JSP pages have session data available. There are performance benefits to switching session to false.

Default is set to true.

Controls the use of buffered output for a JSP page. Default is 8kb

<%@ page buffer = "none" %>
autoFlush Flush output buffer when full. <%@ page autoFlush = "true" %>

Can the generated Servlet deal with multiple requests? If true a new thread is started so requests are handled simultaneously.


Developer uses info attribute to add information/document for a page. Typically used to add author,version,copyright and date info.   

<%@ page info = " test
page,copyright 2001. " %>

Different page to deal with errors. Must be URL to error page.

<%@ page errorPage = "/error/error.jsp" %>

This flag is set to true to make a JSP page a special Error Page. This page has access to the implicit object exception (see later).

contentType Set the mime type and character set of
the JSP.

2. Include directive

It allows a JSP developer to include contents of a file inside another. Typically include files are used for navigation,headers,tables and footers that are common to multiple pages.
Two examples of using include files:

This includes the html from privacy.html found in the include directory into the current jsp page.

<%@ include file = "include/privacy.html" %>

or to include a naviagation menu (jsp file) found in the current directory.

<%@ include file = "navigation.jsp" %>

3. Tag Lib directive
A tag lib is a collection of custom tag that can be used by the page.

<%@ taglib uri = "tag library URI" prefix = "tag Prefix" %>

Custom tag were introduced in JSP 1.1 and allow JSP developer to hide complex server side code from web designers

Scriptlet tag

Scriptlet tag ( <% ... %> )

Between <% and %> tags,any valid Java code is called a Scriptlet. This code can access any variable or bean declared.   For example,to print a variable. 

        String username = "visualbuilder" ;
        out.println ( username ) ;

Action tag

There are three main roles of action tag :
1)    It enable the use of server side Javabeans
2)    It transfer control between pages
3)    Browser independent support for applets.


A Javabeans is a special type of class that has a number of methods. The JSP page can call these method so can leave most of the code in these Javabeans. For example,if you wanted to make a feedback form that automatically sent out an email. By having a JSP page with a form,when the visitor presses the submit button this send the details to a Javabean that sends out the email. This way there would be no code in the JSP page dealing with sending emails (JavaMail API) and your Javabeans could be used in another page (promoting reuse).
To use a Javabeans in a JSP page use the following syntax:

<jsp : usebean id = " ...." scope = "application" class = "com..." />

The following is a list of Javabean scopes:

page - valid until page completes.
request - bean instance lasts for the client request
session - bean lasts for the client session.
application - bean instance created and lasts until application ends.

Be the first one to comment on this page.

  JSP Tutorial eBooks

No eBooks on JSP could be found as of now.

 JSP Tutorial FAQs
More Links » »
 JSP Tutorial Interview Questions
More Links » »
 JSP Tutorial Articles
More Links » »
 JSP Tutorial News
More Links » »
 JSP Tutorial Jobs
More Links » »

Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: JSP Tags, jsp custom tags, jsp action tags, jstl tags, jsp tag, tags in jsp, custom tags in jsp, jsp tag library, jsp custom tag, jsp tag libraries, jstl tag, custom tag in jsp, tag libraries in jsp, include tag in jsp, jsp include tag, tag library in jsp, jsp forward tag, jstl tag library, forward tag in jsp, jsp tag lib, jsp usebean tag, tags jsp, javax servlet jsp tagext tag, div tag in jsp, display tag in jsp, jsp custom tags tutorial, jsp tags in ibm websphere, usebean tag in jsp, select tag in jsp, jsp tag library tutorial, using jstl tags, action tags in jsp, jsp standard tag library, jsp custom tag library, jsp import tag, tag lib in jsp, jsp custom tag libraries, tag in jsp, servlet tag, taglib tag, using jsp custom tag, web xml tags, using jstl tag, request getparameter jsp, jsp source code
© 1999-2007 - This article has been adapted from

HTML Quizzes
CSS Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
XML Quizzes
XML Quiz
XSL Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2022 Vyom Technosoft Pvt. Ltd., All Rights Reserved.