Java Server Programming For Professionals
Java Server Programming For Professionals
JAVA EE 5 TECHNOLOGIES......................................................................................................31
Java Servlet Technology.............................................................................................................31
Enterprise Java Beans Technology .............................................................................................31
Java Server Pages Technology ...................................................................................................32
Java Server Pages Standard Tag Library ....................................................................................32
Java Server Faces........................................................................................................................32
SUN JAVA SYSTEM APPLICATION SERVER PLATFORM EDITION 9.0................................33
Glassfish .........................................................................................................................................33
4. INSTALLATION OF JAVA ENTERPRISE EDITION 5 ............................................................35
DOWNLOADING JAVA ENTERPRISE EDITION 5 SDK.............................................................35
INSTALLING JAVA ENTERPRISE EDITION 5 SDK....................................................................37
Installing Java Enterprise Edition 5 On Linux................................................................................37
Graphical Interface Based...........................................................................................................37
Console Based ............................................................................................................................42
Installing Java Enterprise Edition 5 On Windows ..........................................................................48
UNINSTALLING JAVA ENTERPRISE EDITION 5.......................................................................55
Uninstalling Java Enterprise Edition 5 on Linux ............................................................................55
Graphical Interface Based...........................................................................................................55
Console Based ............................................................................................................................58
Uninstalling Java Enterprise Edition 5 On Windows .....................................................................59
5. INTRODUCTION TO WEB APPLICATION ..............................................................................62
The Web Browser...........................................................................................................................64
The Web Server ..............................................................................................................................65
WEB APPLICATION ARCHITECTURE .........................................................................................65
COLLECTING DATA .......................................................................................................................66
SENDING THE WEB SERVER A REQUEST .................................................................................67
The GET Method............................................................................................................................67
The POST Method..........................................................................................................................68
Which Method Should Be Used .....................................................................................................69
EXECUTING SERVER SIDE SCRIPTS / PROGRAMS..................................................................69
RETURNING THE RESULTS TO A BROWSER............................................................................70
DEVELOPING SERVER APPLICATIONS .....................................................................................70
SERVER-SIDE TECHNOLOGIES ...................................................................................................70
Common Gateway Interface ...........................................................................................................71
Proprietary Web Server's APIs [ISAPI, NSAPI] ............................................................................72
Active Server Pages........................................................................................................................72
Java Servlets And Java Server Pages..............................................................................................73
WHY USE JAVA'S SERVER SIDE TECHNOLOGIES...................................................................74
Platform Independence ...................................................................................................................74
Efficiency .......................................................................................................................................74
Access To Enterprise Java API's ....................................................................................................74
Reusability ......................................................................................................................................75
Modularity ......................................................................................................................................75
Table Of Contents
Page ix
Table Of Contents
Page xi
Table Of Contents
Page xiii
Extensible Tags.............................................................................................................................450
Platform Compatibility .................................................................................................................450
JSP ARCHITECTURE.....................................................................................................................450
The Page-Centric Approach .........................................................................................................450
Page View Architecture............................................................................................................451
Page View With Bean Architecture..........................................................................................451
The Dispatcher Approach .............................................................................................................452
LIFE CYCLE OF A JSP PAGE .......................................................................................................453
HOW DOES A JSP FUNCTION .....................................................................................................454
HOW DOES JSP EXECUTE ...........................................................................................................458
DEPLOYING AND EXECUTING JSP ...........................................................................................459
Modifying JSP page......................................................................................................................470
FEATURES OF JSP 2.1...................................................................................................................471
The Unified Expression Language [EL] .......................................................................................472
Better Alignment With JSF ..........................................................................................................472
Injection Annotations....................................................................................................................473
Blank Lines Removed...................................................................................................................473
Backward Compatibility...............................................................................................................475
17. GETTING STARTED WITH JAVA SERVER PAGES...........................................................477
COMMENTS ...................................................................................................................................477
TEMPLATE TEXT ..........................................................................................................................478
JSP ELEMENTS ..............................................................................................................................479
Directives......................................................................................................................................480
The page Directive....................................................................................................................481
The include Directive ...............................................................................................................485
The taglib Directive ..................................................................................................................487
Scripting Elements........................................................................................................................488
Declarations ..............................................................................................................................488
Scriptlets ...................................................................................................................................489
Expressions...............................................................................................................................490
A SAMPLE JSP PAGE ....................................................................................................................491
HANDS ON EXERCISES ...............................................................................................................498
18. JAVA SERVER PAGES DOCUMENT......................................................................................500
Directives......................................................................................................................................502
The page Directive....................................................................................................................502
The include Directive ...............................................................................................................504
The taglib Directive ..................................................................................................................505
Scripting Elements........................................................................................................................506
Declarations ..............................................................................................................................506
Scriptlets ...................................................................................................................................507
Expressions...............................................................................................................................507
A SAMPLE JSP DOCUMENT ........................................................................................................508
HANDS ON EXERCISES ...............................................................................................................523
Table Of Contents
Page xv
Table Of Contents
Page xvii
Table Of Contents
Page xix
Table Of Contents
Page xxi
NAVIGATION................................................................................................................................. 963
Configuring Navigation Rule ....................................................................................................... 964
Ways Of Navigating Between Pages........................................................................................ 967
The Default Navigation Case ............................................................................................... 967
The Default Outcome Case .................................................................................................. 967
Using Wildcards Or Patterns ................................................................................................ 968
Using The <from-action> Element....................................................................................... 969
Global Outcome ................................................................................................................... 970
Redirect Rendering............................................................................................................... 970
Navigation Cases Split Over Multiple Rules........................................................................ 972
Overlapping Navigation Cases ............................................................................................. 972
Conflict Of Navigation Cases............................................................................................... 973
Navigation Process ....................................................................................................................... 974
Types Of Navigation .................................................................................................................... 976
Simple Or Static Navigation..................................................................................................... 976
Complex Or Dynamic Navigation............................................................................................ 978
Actions And Navigation ............................................................................................................... 980
Implementing Application Actions .............................................................................................. 981
28. CONVERTERS AND VALIDATORS ....................................................................................... 995
CONVERTERS................................................................................................................................ 996
VALIDATORS ................................................................................................................................ 996
CONVERSION AND VALIDATION PROCESS........................................................................... 997
GETTING STARTED WITH CONVERTERS ............................................................................... 998
Standard Converters ..................................................................................................................... 999
DateTime Converter ............................................................................................................... 1000
Number Converter.................................................................................................................. 1003
Custom Converters ..................................................................................................................... 1005
Implementing The Converter Interface .................................................................................. 1006
Implementing The getAsObject() Method.............................................................................. 1007
Implementing The getAsString() Method .............................................................................. 1008
Registering The Custom Converter ........................................................................................ 1008
Using The <f:converter> Element .......................................................................................... 1010
GETTING STARTED WITH VALIDATORS .............................................................................. 1011
Standard Validators .................................................................................................................... 1012
Length Validator..................................................................................................................... 1012
Long Range Validator ............................................................................................................ 1013
Double Range Validator ......................................................................................................... 1013
Custom Validators...................................................................................................................... 1014
Implementing A Validator Interface....................................................................................... 1015
Implementing The validate() Method..................................................................................... 1015
Registering A Custom Validator ............................................................................................ 1016
Using The <f:validator> Element........................................................................................... 1017
Application Level Validation ..................................................................................................... 1017
Validator Methods In Backing Bean .......................................................................................... 1018
The required And The immediate Attributes.............................................................................. 1020
The required Attribute ........................................................................................................ 1020
Table Of Contents
Page xxiii
Table Of Contents
Page xxv
Table Of Contents
Page xxvii