Welcome to JavaServer Pages, 2nd Edition

Here you find all examples described in the book, as well as the JavaDocs for all Java classes used in the examples. I hope you will have fun reading the book and that you'll find the examples useful.

Hans Bergsten

Chapter 5

JSP is Easy
Source:
easy.jsp

Chapter 6

Cartoon Bean
Source:
cartoon.jsp
Cartoon Bean with JSTL
Source:
cartoon2.jsp
Message Bean
Source:
message.jsp

Chapter 7

Message Custom Action
Source:
message.jsp

Chapter 8

JSTL Parameter Access
Source:
input_jstl.jsp
JSTL Request Data Access
Source:
reqinfo.jsp
Bean Parameter Access
Source:
input_bean.jsp
JSTL Validation
Source:
validate_jstl.jsp
Bean Validation
Source:
validate_bean.jsp

Chapter 9

Improperly Terminated Directive
Source:
error1.jsp
Improperly Terminated Action
Source:
error2.jsp
Invalid Attribute Name
Source:
error3.jsp
Missing End Quote
Source:
error4.jsp
Missing EL Curly Braces
Source:
error5.jsp
Missing End EL Curly Brace
Source:
error6.jsp
Invalid Property Name
Source:
error7.jsp
Invalid Parameter Name
Source:
error8.jsp
Logical Error
Source:
error9.jsp
Debug Output
Source:
debug.jsp
Runtime Exception and Error Page
Source:
calc.jsp
errorpage.jsp
Runtime Exception and Catch
Source:
calc2.jsp

Chapter 10

Separate Validation Page
Source:
userinfoinput.jsp
userinfovalidate.jsp
userinfovalid.jsp
Session and Application Scope Counters
Source:
counter1.jsp
URL Rewriting
Source:
counter2.jsp
Shopping Cart
Source:
catalog.jsp
product.jsp
addtocart.jsp

Chapter 11

All these examples require a database

Employee Registration

Source:
enter.jsp
validate.jsp
store.jsp
confirmation.jsp
Employee Search
Source:
search.html
find.jsp
list.jsp
delete.jsp
Getting a Few Rows at a Time
Source:
maxrows.jsp
Displaying a Few Rows at a Time
Source:
foreach.jsp

Chapter 12

All these examples require a database

Container-Provided Security, Employee Registration

Source:
enter.jsp
validate.jsp
store.jsp
confirmation.jsp
Container-Provided Security, Employee Search
Source:
search.html
find.jsp
list.jsp
delete.jsp
Application-Controlled Security, Project Billboard
Source:
login.jsp
authenticate.jsp
main.jsp
entermsg.jsp
storemsg.jsp
updateprofile.jsp
logout.jsp

Chapter 13

Localized Poll Application
Source:
poll.jsp
calculate.jsp
result.jsp
details_en.jsp
details_sv.jsp
details_de.jsp
Japanese Hello World

This example requires a browser with Japanese font

Source:
japanese.jsp
Localized Input for Western Languages
Source:
input.jsp
process.jsp
Localized Input for Non-Western Languages

This example requires a browser with Japanese, Greek and Russian fonts

Source:
input_nw.jsp
process_nw.jsp

Chapter 14

WML Phone Book

This example requires a WML browser

Source:
phone_wml.jsp
XSLT to HTML Transformation
Source:
phone_html.jsp
htmltable.xsl
Device-Dependent XSLT Transformation
Source:
phone.jsp
html.xsl
wml.xsl
XML-Based News Service
Source:
news.jsp

Chapter 15

Using Scriptlets
Source:
scriptlet.jsp
Using Scriptlets With Code Fragments
Source:
fragment.jsp
Declaring Variables
Source:
counter.jsp
Declaring Methods
Source:
color.jsp
Using the JSTL RT Libraries
Source:
core-rt.jsp
All Scripting Elements
Source:
allinone.jsp
Invalid Semicolon and Missing Brace
Source:
error1.jsp
Invalid Scripting Element Type
Source:
error2.jsp
Missing Import
Source:
error3.jsp

Chapter 16

Including Page Fragments
Source:
page1.jsp
page2.jsp
page3.jsp
header.htmlf
footer.htmlf
navigation_jstl.jsp
navigation.jsp
Validation with JavaScript
Source:
clientscript.jsp
Dynamically Generated JavaScript

This example requires a database

Source:
selections.jsp
dynamicscript.jsp
Using an Applet
Source:
applet.jsp
Writing a JSP Document (XML Syntax)
Source:
jspdocument.jsp

Chapter 18

Application-Controlled Security, Servlet and JSP

This example requires a database

Source:
login.jsp
main.jsp
entermsg.jsp