JSP Tutorials
JSP Tutorials and examples, you will find many examples with
working source code.
-
Introduction to JSP
Java Server Pages or JSP for short is Sun's solution
for developing dynamic web sites. JSP provide excellent server side
scripting support for creating database driven web applications.
-
JSP
Tutorials - Introducing Java Server Pages Technology
JavaServer Pages (JSP) technology is the Java platform technology for
delivering dynamic content to web clients in a portable, secure and
well-defined way.
-
JSP
Architecture
JPS pages are high level extension of servlet and it enable the developers
to embed java code in html pages. JSP files are finally compiled into a
servlet by the JSP engine. Compiled servlet is used by the engine to serve
the requests.
-
Introduction
to the JSP tags(This section also
describe JSP Directives)
In this lesson we will learn about the various tags available in JSP with
suitable examples. In JSP tags can be devided into 4 different types.
- Detail
introduction to JSP Declaratives
JSP Declaratives begins with <%! and ends %>
with .We can embed any amount of java code in the JSP Declaratives.
Variables and functions defined in the declaratives are class level and
can be used anywhere in the JSP page.
- Detail
Introduction to JSP Scriptlets and JSP Expressions with examples
JSP Scriptlets begins with <% and ends %>
.We can embed any amount of java code in the JSP Scriptlets. JSP Engine
places these code in the _jspService() method.
- Writing the
Date JSP
Till now you learned about the JSP syntax, now I will show you how to
create a simple dynamic JSP page that prints the current date and time.
- Reading the Request
Information
When an HTTP client such as web browser sends a request to a wen server,
along with the request it also sends some HTTP variables like Remote
address, Remote host, Content type etc.
- Retrieving the data
posted to a JSP file from HTML file
Now I will show you how to retrieve the data posted from a HTML file in a
JSP page. Consider an html page that prompts the user to enter his/her
name, let's call it getname.htm.
- Accessing database from JSP
In This article I am going to
discuss the
connectivity from MYSQL database with JSP.we take a example of Books
database. This database contains a table named books_details.
- Working with JSP
Sessions
This JSP Tutorial shows you how to track the session
between different JSP pages. In any web application user moves from one page
to another and it becomes necessary to track the user data and objects
throughout the application. JSP provide an implicit object
"session", which can be use to save the data specific the
particular to the user.
- JSP Cookies Example
This tutorial shows how to handle cookies in JSP
pages. In this tutorial you will learn how to add cookies through jsp page
and then show the value of the same cookie in another JSP page.
- Disabling
Session in JSP
In this tutorial you will learn how to disable session
creation in the JSP pages. Disabling the session in some pages will improve
the performance of your JSP container.
- JSP PDF books
Collection is jsp books in the pdf format. You can download these books and
study it offline.
- Free JSP Books
Download the following JSP books.
-
Free
JSP Download
BooksFree JSP Books for instant downloads.
JSP 2.0
- New Features in JSP 2.0
JSTL Tutorial By R.S.RAMASWAMY.
Comments on this article may be sent to: [email protected]
- INTRODUCTION
TO JSTL
- JSTL tags in
the core-group
- JSTL XML Tags
- SQL tags in
JSTL
JSP Fundamentals
This is an excellent tutorial on JSP for the
beginners. Tutorial describes how to use Bean in JSP, Connection Pooling in JSP
and the use of taglibs.
- JSP Fundamentals
JSP termed as Java Server Pages is a technology
introduced by Sun Microsystems Inc. to develop the web application in more
efficient way than Servlets. It has got many advanced features than
servlets, one of them itself define the JSP i.e. JSP separates the
presentation logic from the business logic and provide the designer and
developer of the web application to work independently without any hassle.
- Using Beans in JSP
Java Beans are reusable components. They
are used to separate Business logic from the Presentation logic. Internally,
a bean is just an instance of a class.
- JSP Taglibraries
JSP�s offer a unique feature of �Tag
Libraries�. Simply put, these are custom defined JSP tags. They are
basically meant for componentizing presentation level logic. They are very
similar to beans except the fact that Beans are used to separate Business
logic.
JSP Examples
- Calculate
a factorial by using while loop
In this example we are going to find out the
factorial of 12 by using the while loop. In while loop the loop
will run until the condition we have given gets true.
- Calculate
factorial
After going through this example you will be
understand how you can calculate the factorial by using recursion in jsp.
To make a program on factorial, firstly it must be clear what is
recursion.
- Celsius
to Fahrenheit
Celsius is a unit to measure temperature
scale on which water freezes at 0 degree and boiling point is 100 degree.
This unit is discovered by Celsius in 1742, a Swedish astronomer and
physicist, he has invented the centigrade, or Celsius thermometer divided
between the freezing and boiling points of water into 100 parts.
- Comment
In a jsp we should always try to use jsp-
style comments unless you want the comments to appear in the HTML. Jsp
comments are converted by the jsp engine into java comments in the source
code of the servlet that implements the Jsp page.
- Html
tag inside out implicit object
In this program we are going to use a html
tag inside a out object. out object is used to display the content on the
browser. To make this program run use out object inside which define some
html code along with the content you want to display on the browser
- Jsp
methods
In this example we are going to show
you how we can declare a method and how we can used it. In this example we
are making a method named as addNum(int i, int b) which will take
two numbers as its parameters and return integer value.
- multiple
method
Jsp is used mainly for presentation logic.
In the jsp we can declare methods just like as we declare methods in java
classes. Methods can be declared in either declaration directive or we can
declare it in scriptlet. If we declare method inside declaration
directive, then the method is applicable in the whole page.
- Passing
Array method
Array is a collection of similar data type.
It is one of the simplest data structures. Arrays holds equally
sized data elements generally of the similar data type.
- Two
index
In this example we will show how we can use
two indexes in a for loop. We can solve this problem by using for loop
defined inside the scriptlet directive.
- Celsius To Fahrenheit
In this example you will learn how to convert the temperature Celsius to
Fahrenheit. To change the Celsius to Fahrenheit we have the formula Fahrenheit =
32 + 9*c/5.
- JSP Methods
In this example we are going to show you how we
can declare a method and how we can used it. In this example we are making a
method named as addNum(int i, int b) which will take two numbers as its
parameters and return integer value.
- Multiple Methods
Jsp is used mainly for presentation logic. In the jsp
we can declare methods just like as we declare methods in java classes. Methods
can be declared in either declaration directive or we can declare it in
scriptlet.
- Hello World JSP Page
By this example we are going to teach you that how can
you write a "hello world" on your browser. Jsp can be learned very
easily. This is just the beginning to learn this exciting language.
- The Page Directive
in JSP Page
This section illustrates you about the page
directive of the JSP page which works for the entire JSP page. These directives
apply different properties for the page like language support, page information
and import etc.
- The extends Attribute of page Directive In JSP
- The import
Attribute of page Directive In JSP
This section shows you how to import a java package or
the class in your jsp application.
- The session Attribute of page Directive In JSP
This section provides you the best illustration of the session
attribute of the page directive in JSP. This is the boolean attribute of
the directive. It sets a boolean value
either true or false.
- The buffer Attribute of page Directive In JSP
This section just introduces about the buffer attribute
of the page directive in JSP. This attribute sets the buffer size in
kilobytes i.e. used by the out object to handle output generated by the JSP page
on the client web browser.
- The autoFlush Attribute of page Directive In JSP
This section illustrates you about the autoFlush
attribute of the page directive in JSP. This is an boolean attribute. This attribute of the page
directive supports for flushing buffer automatically when the buffer is full.
- The isThreadSafe Attribute of page Directive In
JSP
In this section, you will learn about a type of the
attribute of the page directive in JSP as known as isThreadSafe
attribute.
- The info Attribute of page Directive In JSP
This section gives you the introduction about the info
attribute of the page directive in JSP. This attribute simply sets the information
of the JSP page which is retrieved later by using Servlet.getServletInfo()
method.
- The errorPage Attribute of page Directive In JSP
This section illustrates you about the errorPage
attribute of the page directive in JSP. This attribute sets a url (relative
path starting from the "/" which refers from the root directory of
your JSP application).
- The contentType Attribute of page Directive In
JSP
This section gives you the best illustration about the contentType
attribute of the page directive in JSP. This attribute specifies the MIME
type and the character encoding i.e. used for the JSP response.
- The isErrorPage Attribute of page Directive In
JSP
This section provides the best illustration of the isErrorPage
attribute of the page directive in JSP by providing three JSP pages and
it's output. This is a boolean attribute of the page directive.
- The pageEncoding Attribute of page Directive In
JSP
This section provides the best illustration about the pageEncoding
attribute of the page directive in JSP. This attribute specifies the
language that the page uses when the page is sent to the browser. This attribute
works like the meta tag of the HTML markup language.
- The isELIgnored Attribute of page Directive In
JSP
- The Include
Directive in JSP Page
This section illustrates you about the include
directive of the JSP. You will learn about what is include and how to
implement it in the JSP page.
- How to create a form in JSP
This section illustrates you about the procedure of
the creation of a form through the HTML code in the JSP page. You can simply
use the <form></form> tags for creating a from and save the file
with the ".jsp" extension.
- How
to handle a form in JSP
This section teaches you about the creating a from and
the procedure of handling the form through the JSP code. This section
provides JSP code which used the HTML code for creating a form and this form
is handled by the JSP code.
- Get Method of the
Form In JSP
This section provides you the best illustration of the get
method of the form in JSP. The HTTP get method sends data to the server.
- Post Method of the Form In JSP
This section provides you the best illustration of the post
method of the form in JSP. The HTTP post method sends data to the server
from the HTML form elements.
- What Is Tag Libray In
JSP?
This section provides you the detailed explanation of
the Tag Library in JSP. In the Java Server Pages Technology, multiple
actions are accessed by using the tags of the JSP whether the tag is standard
tag of the JSP or the custom tag that is made by you.
- Declaring Tag
Library In JSP
Tag libraries are declared by using the <%@taglib %> directive of
the JSP. This tag has some own attributes and it's values are specified
attributes specifically of the taglib directive.
- Request Object
In JSP
This section illustrates more about the JSP implicit
object called Request object. This object retrieves values whatever
client passes to the server by an HTTP request.
- getParameter() Method Of The Request Object
This section illustrates you about the getParameter()
method of the request object. This section provides you the best
illustration for why the method used or how to use in your JSP application.
- getParameterNames()
Method Of The Request Object
This section gives you the detailed explanation about
the getParameterNames() method of the request object. You
will learn more about the procedure of using the getParameterNames()
method of the request object.
- getParameterValues()
Method Of The Request Object
This section illustrates you about the getParameterValues()
method of the request object. Here, you will learn more about the getParameterValues()
method like what's the need of using the method in your JSP application.
- getCookies() Method Of The Request Object
- getQueryString()
Method Of The Request Object
This section describes the getQueryString()
method of the request object. Here, you will learn more about the getQueryString()
method of the request like what's the need of the method and how to implement it
into your JSP application code.
- getRequestURI() Method Of The Request Object
This section gives you the detailed explanation of the getRequestURI()
method of the request object in JSP. This method is used for getting the
information of the URI of the current page of your JSP application.
- getHeaderNames() Method Of The Request Object
In this section, you will learn how to get the header name of the host
server. This section gives you the brief introduction about the getHeaderNames()
method of the request object.
- getHeader() Method Of The Request Object
This section gives you the best illustration about the getHeader()
method of the request object. Here, you will learn more about the getHeader()
method like why is it used and how is it implemented.
- getAttribute() Method Of The Request Object
This is the page for the illustration of the getAttribute()
method of the request object in JSP. This method retrieves the values
corresponding to the given attribute name that is set through the setAttribute()
method of the request object.
- getAttributeNames() Method Of The Request Object
This section provides you the detailed explanation of
the getAttributeNames() method of the request object in JSP. Here,
you will learn why this is used and how it is used in the JSP application.
- setAttribute() Method Of The Request Object
This section gives you the best illustration about the setAttribute()
method of the request object in JSP. This method sets the value of the
attribute for the request.
- removeAttribute() Method Of The Request Object
This section introduces for the method removeAttribute() of the
request object. This method removes the attribute. This method takes a
string type parameter i.e. the attribute name that has to be removed.
- Response Object In JSP
-
JSP Session Examples
- JSP Examples TOC
JSP Session Tutorials Toc
- HTTP
Protocol
HTTP Protocol stands for Hyper Text Transfer
Protocol. It is the protocol used to convey information of World Wide Web
(WWW).
- Session
Management in JSP
In session management whenever a request comes for
any resource, a unique token is generated by the server and transmitted to
the client by the response object and stored on the client machine as a
cookie.
- Cookies
in JSP
When cookie based session management is used, a token is generated which
contains user's information, is sent to the browser by the server.
- JSP
URL Rewriting
URLRewriting can be used in place where we don't want to use
cookies. It is used to maintain the session.
- JSP
Hidden Form Fields
It is one of the way to maintain the session. In hidden form fields the
html entry will be like this : <input type ="hidden" name =
"name" value="">.
- Preventing
the creation of a Session in a Jsp Page
In jsp the session is by default true, if we don't declare a session =
"true" inside the directive, then the session is still
available as it is by default true.
- JSP:
View Session
The view consists of the Html page or the jsp components that
provide the user interface. View is what we see. It is mainly for
presentation.
- Duplicated
Session Variables
We don't have any need to create a new session variable because it
has been created by the JSP container for you.
Many JSP
Tutorials
Collection of a large number of JSP Tutorials
|