Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F627663
index.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
13 KB
Referenced Files
None
Subscribers
None
index.html
View Options
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<
html
>
<
head
>
<
title
>
Servlet Examples
</
title
>
<
meta
name
=
"author"
content
=
"Jens Dietrich"
>
<
meta
name
=
"description"
content
=
"Index page containing links to and short descriptions of some Servlet examples"
>
</
head
>
<
body
style
=
"color: rgb(0, 0, 0); background-color: rgb(238, 238, 255);"
link
=
"#000099"
vlink
=
"#990099"
alink
=
"#000099"
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"0"
style
=
"text-align: left; width: 100%;"
>
<
tbody
>
<
tr
>
<
td
style
=
"background-color: rgb(160, 170, 238); text-align: center; vertical-align: middle;"
>
<
h4
style
=
"text-align: center; background-color: rgb(160, 170, 238);"
>
</
h4
>
<
h3
style
=
"text-align: center;"
>
Servlet and JSP Examples
</
h3
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
br
>
<
h3
>
Servlets
</
h3
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"1"
style
=
"text-align: left; width: 100%;"
>
<
tbody
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"ServerDate"
>
Example1
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
Basic example that prints the
current server date and time.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
<
a
href
=
"CSVViewer"
>
Example2
</
a
></
td
>
<
td
style
=
"vertical-align: top;"
>
A servlet displaying a CSV data
file as a table.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"HeaderAnalyzer"
>
Example3
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A servlet displaying request
headers.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
Example4
<
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
An html form processing servlet.
Press the submit button to send this form to a form processing servlet.
<
br
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"1"
style
=
"text-align: left; width: 100%;"
>
<
tbody
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"1"
style
=
"text-align: left; width: 100px;"
>
<
tbody
>
<
tr
>
<
td
style
=
"vertical-align: top; background-color: rgb(204, 204, 204);"
>
name:
<
br
>
<
form
action
=
"FormAnalyzer"
>
<
input
name
=
"name"
size
=
"50"
>
<
br
>
first name:
<
br
>
<
input
name
=
"firstname"
size
=
"50"
><
br
>
<
br
>
is NZ citizen:
<
input
name
=
"citizen"
type
=
"checkbox"
value
=
""
><
br
>
<
hr
style
=
"width: 100%; height: 2px;"
><
input
type
=
"submit"
value
=
"Submit (GET)"
>
</
form
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"1"
style
=
"text-align: left; width: 100px;"
>
<
tbody
>
<
tr
>
<
td
style
=
"vertical-align: top; background-color: rgb(204, 204, 204);"
>
name:
<
br
>
<
form
action
=
"FormAnalyzer"
method
=
"post"
>
<
input
name
=
"name"
size
=
"50"
>
<
br
>
first name:
<
br
>
<
input
name
=
"firstname"
size
=
"50"
><
br
>
<
br
>
is NZ citizen:
<
input
name
=
"citizen"
type
=
"checkbox"
value
=
""
><
br
>
<
hr
style
=
"width: 100%; height: 2px;"
><
input
type
=
"submit"
value
=
"Submit (POST)"
>
</
form
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
br
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"Cookie"
>
Example5
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
An example using (persistent)
cookies.
<
a
href
=
"ShopingCart"
><
br
>
</
a
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
<
a
href
=
"ShoppingCart"
>
Example6a
<
br
>
</
a
></
td
>
<
td
style
=
"vertical-align: top;"
>
Shopping Cart example that uses
session handling. Cookies
<
span
style
=
"font-weight: bold;"
>
must
</
span
>
be
enabled.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"ShoppingCart2"
>
Example6b
</
a
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
Shopping Cart example that uses
session handling. This example does not rely on cookies!
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
Example7
<
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A SQL query servlet. Can query
data from every database (but note that we do not pass user info/
password). E.g., test it with mysql
or odbc.
<
br
>
<
br
>
<
br
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"1"
style
=
"text-align: left; width: 50%; background-color: rgb(204, 204, 204);"
>
<
tbody
>
<
tr
>
<
td
style
=
"vertical-align: top;"
>
<
form
action
=
"SQLQueryServlet"
><
br
>
<
input
name
=
"driver"
value
=
"com.mysql.jdbc.Driver"
size
=
"50"
><
br
>
<
br
>
<
input
name
=
"url"
value
=
"jdbc:mysql://localhost/test"
size
=
"50"
><
br
>
<
br
>
<
input
name
=
"query"
value
=
"select * from students"
size
=
"50"
><
br
>
<
hr
style
=
"width: 100%; height: 2px;"
><
input
value
=
"Run Query"
type
=
"submit"
></
form
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"login"
>
Example8
<
br
>
</
a
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
An application that uses modular
design based on forward and include.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"example9/clock.html"
>
Example9
<
br
>
</
a
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A servlet generating a
dynamically generated image. The image visualizes the current time. Use
refresh (F5) to update the image.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"CatalogServlet"
>
Example10
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A more complex example
illustrating principles of XML based web publishing.
<
br
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
br
>
<
h3
>
JSP
</
h3
>
<
br
>
<
table
cellpadding
=
"2"
cellspacing
=
"2"
border
=
"1"
style
=
"text-align: left; width: 100%;"
>
<
tbody
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/ServerDate.jsp"
>
Example1
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A simple JSP page which displays
the current server time.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/ServerDate2.jsp"
>
Example2
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
Similar to example 1, but uses
more scriptlets and expressions and predefined object references.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/PageCounter.jsp"
>
Example3
</
a
><
br
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A page counter using a
declaration.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/DBConnect.jsp"
>
Example4
<
br
>
</
a
></
td
>
<
td
style
=
"vertical-align: top;"
>
An example demonstartion JSP
Exception handling. The request fails (the database URL used in the
scriptlet is invalid), and a special error page is shown instead.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/StudentEditor.jsp"
>
Example5
<
br
>
</
a
></
td
>
<
td
style
=
"vertical-align: top;"
>
A student editor illustration
bean based form processing. This example also uses a session.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/ELExample.jsp"
>
Example6
<
br
>
</
a
></
td
>
<
td
style
=
"vertical-align: top;"
>
Shows the use of the JSP 2.0 Expression Language.
<
br
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"vertical-align: top;"
><
a
href
=
"jsp/SQL.jsp"
>
Example7
</
a
>
</
td
>
<
td
style
=
"vertical-align: top;"
>
A page that uses a simple SQL
SELECT tag.
<
br
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
<
br
>
<
hr
style
=
"width: 100%; height: 2px;"
><
br
>
<
p
align
=
"center"
><
small
><
small
>
<
a
href
=
"http://www-ist.massey.ac.nz"
>
Institute Home
</
a
>
|
<
a
href
=
"http://www.massey.ac.nz"
>
Massey University Home
</
a
><
br
>
©
2003,
<
a
href
=
"mailto:j.b.dietrich@massey.ac.nz"
>
Jens Dietrich
</
a
><
br
>
</
small
></
small
></
p
>
<
br
>
</
body
>
</
html
>
File Metadata
Details
Attached
Mime Type
text/html
Expires
Sun, Nov 15, 2:29 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
136871
Default Alt Text
index.html (13 KB)
Attached To
Mode
R21 OOP Examples
Attached
Detach File
Event Timeline