The Tellurium Automated Testing Framework (Tellurium) is a UI module-based automated testing framework for web applications and it is robust, expressive, flexible, and reusable. This is Tellurium 0.6.0 User Guide.
Tellurium 0.7.0 is a major release and we have worked on this release for almost one year. We have closed over 200 issues and have included many interesting new features. To make it easier for people to get familiar with Tellurium, we prepared the reference document to cover almost everything you need to know about Tellurium. The reference document is about 280 pages including 14 chapters and appendices.
The Tellurium Automated Testing Framework (Tellurium) is a UI module-based automated testing framework for web applications and it is robust, expressive, flexible, and reusable. This is Tellurium 0.6.0 User Guide.
Tellurium 0.7.0 is a major release and we have worked on this release for almost one year. We have closed over 200 issues and have included many interesting new features. To make it easier for people to get familiar with Tellurium, we prepared the reference document to cover almost everything you need to know about Tellurium. The reference document is about 280 pages including 14 chapters and appendices.
AppLoader is a complete Quality Assurance solutions package designed for every vertical industry and every application accessible from a windows front end. This means no plugins or wrappers and no additional cost to you. AppLoader prevents application performance problems before they start, providing end-to-end flexible variations of tests: smoke testing, regression testing, performance testing, stress testing, functional testing, security testing, and more.
Zimbrick GMC West, a Madison GMC dealership Wisconsin has turned to for their automotive needs since 1965, is proud to provide fleet and upfitting services for the 2011 GMC Savana. Please call (608) 271-1601 for more information.
MFG/PRO QAD Reporting Framework Document GuideVinh Nguyen
MFG/PRO QAD Reporting Framework Document Guide.
If you need to find a perfect solution for your business or should you have any questions please do not hesitate to contact Think Next- QAD partner in Vietnam
Website: http://www.thinknext.vn
Forum: http://www.thinknext.vn/diendan/index.php?threads/guide-qad-reporting-framework-administration.258/
AppLoader is a complete Quality Assurance solutions package designed for every vertical industry and every application accessible from a windows front end. This means no plugins or wrappers and no additional cost to you. AppLoader prevents application performance problems before they start, providing end-to-end flexible variations of tests: smoke testing, regression testing, performance testing, stress testing, functional testing, security testing, and more.
Zimbrick GMC West, a Madison GMC dealership Wisconsin has turned to for their automotive needs since 1965, is proud to provide fleet and upfitting services for the 2011 GMC Savana. Please call (608) 271-1601 for more information.
MFG/PRO QAD Reporting Framework Document GuideVinh Nguyen
MFG/PRO QAD Reporting Framework Document Guide.
If you need to find a perfect solution for your business or should you have any questions please do not hesitate to contact Think Next- QAD partner in Vietnam
Website: http://www.thinknext.vn
Forum: http://www.thinknext.vn/diendan/index.php?threads/guide-qad-reporting-framework-administration.258/
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
1. Table of Contents
Introduction..............................................................................................…….xxix
Chapter 1: Getting Started with Web Applications in Java ...............................1
Introduction to Web Applications............................................................................................................................2
Benefits of Web Applications....................................................................................................................................5
Technologies used in Web Applications..................................................................................................................5
Describing JDBC................................................................................................................................................ 5
Exploring the JDBC Architecture........................................................................................................... 6
Describing Java Servlets................................................................................................................................... 7
Advantages of Java Servlets................................................................................................................... 8
Describing JSP.................................................................................................................................................... 8
Request Processing of a JSP Page .......................................................................................................... 9
Describing the JSP Life-cycle.................................................................................................................. 9
Introduction to Web Architecture Models ............................................................................................................10
Describing the Model-1 Architecture ........................................................................................................... 10
Limitations of the Model-1 Architecture ............................................................................................ 11
Describing the Model-2 Architecture ........................................................................................................... 11
Advantages of the Model-2 Architecture ........................................................................................... 12
Introduction to the MVC Architecture...................................................................................................................12
Describing the Model Component................................................................................................................ 13
Describing the View Component.................................................................................................................. 13
Describing the Controller Component ......................................................................................................... 13
Summary....................................................................................................................................................................14
Exercise ......................................................................................................................................................................14
Chapter 2: Getting Started with JDBC ..............................................................15
Introducing ODBC....................................................................................................................................................16
Defining ODBC.........................................................................................................................................................16
Listing Features of ODBC .............................................................................................................................. 17
2. Table of Contents
vi
Describing the ODBC Components .............................................................................................................. 17
The Application Component................................................................................................................ 18
The DriverManager Component ......................................................................................................... 18
The Driver Component......................................................................................................................... 18
The Datasource Component................................................................................................................. 19
Describing the ODBC Architecture............................................................................................................... 19
The Single-tier ODBC Architecture..................................................................................................... 19
The Multiple-tier ODBC Architecture................................................................................................. 20
Introducing JDBC .....................................................................................................................................................20
Describing Components of JDBC.................................................................................................................. 22
Listing Features of JDBC ................................................................................................................................ 22
Listing New Features in JDBC 4.0................................................................................................................. 24
Exploring the JDBC Architecture............................................................................................................................25
The Type-1 Driver........................................................................................................................................... 26
Advantages of the Type-1 Driver ........................................................................................................ 27
Disadvantages of the Type-1 Driver ................................................................................................... 27
Situations to Use the Type-1 Driver .................................................................................................... 27
The Type-2 Driver (Java to native API)........................................................................................................ 27
Advantages of the Type-2 Driver ........................................................................................................ 28
Disadvantages of the Type-2 Driver ................................................................................................... 28
Examples of the Type-2 Driver ............................................................................................................ 28
Situations to Use the Type-2 Driver .................................................................................................... 28
The Type-3 Driver (Java to Network Protocol/All Java Driver)............................................................... 29
Advantages of the Type-3 Driver ........................................................................................................ 29
Disadvantages of the Type-3 Driver ................................................................................................... 29
Examples of the Type-3 Driver ............................................................................................................ 29
Situations to Use the Type-3 Driver .................................................................................................... 30
The Type-4 Driver (Java to Database protocol)........................................................................................... 30
Advantages of the Type-4 Driver ........................................................................................................ 30
Disadvantage of the Type-4 Driver ..................................................................................................... 30
Examples of the Type-4 Driver ............................................................................................................ 31
Summary....................................................................................................................................................................31
Exercise ......................................................................................................................................................................32
State True or False ....................................................................................................................................................32
Chapter 3: Working with JDBC APIs.................................................................33
Introducing JDBC API..............................................................................................................................................34
Explaining the Types of JDBC APIs.............................................................................................................. 35
The JDBC Core API ............................................................................................................................... 35
The JDBC Extension API....................................................................................................................... 36
3. Table of Contents
vii
Listing the New APIs Added to JDBC 4.0.................................................................................................... 37
Describing the Major Classes and Interfaces............................................................................................... 38
The DriverManager Class..................................................................................................................... 38
The Driver Interface .............................................................................................................................. 39
The Connection Interface...................................................................................................................... 40
The Statement Interface ........................................................................................................................ 42
Communicating with Databases by using JDBC APIs.........................................................................................45
Step 1: Obtaining a Connection..................................................................................................................... 46
Obtaining an Connection using Driver object.................................................................................... 46
Step 1.i: Registering a Driver object with DriverManager................................................................ 47
Step 1.ii: Establishing a Connection using DriverManager.............................................................. 48
Step 2: Creating a JDBC Statement Object ................................................................................................... 49
Step 3: Executing SQL Statements................................................................................................................. 49
Step 4: Closing the Connection...................................................................................................................... 49
Creating a Simple Application................................................................................................................................50
Configuring the Application.......................................................................................................................... 51
Creating a Table..................................................................................................................................... 51
Creating a DSN................................................................................................................................................ 51
Understanding Various JDBC Drivers...................................................................................................................53
The OCI8 Driver for Oracle............................................................................................................................ 54
The IDS Driver................................................................................................................................................. 54
Installing the IDS Server ....................................................................................................................... 54
Configuring IDS Driver ........................................................................................................................ 57
The Thin driver for Oracle ............................................................................................................................. 57
Summary....................................................................................................................................................................58
Exercise ......................................................................................................................................................................58
Fill in the blanks with appropriate words or phrases:.........................................................................................58
Chapter 4: Implementing JDBC Statements and ResultSets ..........................59
Describing JDBC Statement.....................................................................................................................................60
Working with the Statement Interface...................................................................................................................60
Exploring the Methods of Statement ............................................................................................................ 60
The executeUpdate (String sqlStatement) Method............................................................................ 61
The executeQuery (String query) Method.......................................................................................... 61
The execute (String sqlStatement) Method......................................................................................... 61
The getResultSet () Method .................................................................................................................. 62
The getUpdateCount () Method .......................................................................................................... 62
Using Statement .............................................................................................................................................. 62
Creating a Table..................................................................................................................................... 62
Inserting a Row...................................................................................................................................... 64
4. Table of Contents
viii
Working with the PreparedStatement Interface...................................................................................................65
Comparing Statement and PreparedStatement Objects............................................................................. 66
Describing the setXXX methods of PreparedStatement............................................................................. 67
Listing the Advantages and Disadvantages of PreparedStatement ......................................................... 69
Using PreparedStatement .............................................................................................................................. 69
Creating a PreparedStatement Object................................................................................................. 69
Setting the Values for Parameters........................................................................................................ 70
Executing the PreparedStatement ....................................................................................................... 70
Using PreparedStatement with Parameters................................................................................................. 70
Exploring the Usage of the PreparedStatement Object .............................................................................. 73
Working with the CallableStatement Interface.....................................................................................................73
Describing Stored Procedures ....................................................................................................................... 73
Listing the Benefits of Working with a Stored Procedure ......................................................................... 74
Using CallableStatement ................................................................................................................................ 74
Creating the CallableStatement object ................................................................................................ 74
Setting the Values of the Parameters................................................................................................... 75
Registering the OUT Parameter Type................................................................................................. 75
Executing the Stored Procedure or Function ..................................................................................... 75
Retrieving the Parameter Values ......................................................................................................... 75
Using CallableStatement with Parameters .................................................................................................. 75
Executing a Stored Procedure with IN Parameters........................................................................... 75
Executing a Stored Procedure with OUT Parameters....................................................................... 77
Calling Functions by Using CallableStatement........................................................................................... 79
Using Cursors in CallableStatement............................................................................................................. 81
Comparing Procedure and Function ............................................................................................................ 82
Working with the ResultSet Interface ....................................................................................................................82
Describing the Methods of ResultSet............................................................................................................ 83
Using ResultSet................................................................................................................................................ 85
Moving the Cursor Position ................................................................................................................. 86
Reading the Column Values................................................................................................................. 86
Retrieving All the Rows from a Table .......................................................................................................... 89
Retrieving a Particular Column Using ResultSet........................................................................................ 91
Handling NULL Values...........................................................................................................................................94
Working with the ResultSetMetaData Interface...................................................................................................95
Describing ResultSetMetaData...................................................................................................................... 95
Using ResultSetMetaData .............................................................................................................................. 96
Creating SQLEditor in Java.....................................................................................................................................98
Creating the Command-Based SQLEditor................................................................................................... 98
Creating the Windows-Based SQLEditor................................................................................................... 100
5. Table of Contents
ix
Using Advanced Concepts of ResultSet ..............................................................................................................104
Exploring Characteristics of the ResultSet Object..................................................................................... 104
ResultSet Types.................................................................................................................................... 104
ResultSet Concurrency........................................................................................................................ 105
ResultSet Holdability .......................................................................................................................... 106
Setting the ResultSet Type and ResultSet Concurrency........................................................................... 106
Using ResultSet Objects to Manipulate Data............................................................................................. 112
Using the ResultSet Object to Update Data...................................................................................... 112
Using the ResultSet Object to Delete a Row..................................................................................... 114
Using a ResultSet Object to Insert a Row.......................................................................................... 116
Closing the Connection..........................................................................................................................................118
Closing the Statement and ResultSet.......................................................................................................... 118
Working with the DatabaseMetaData Interface .................................................................................................119
Retrieving Database and Driver Details..................................................................................................... 121
Retrieving Table Description....................................................................................................................... 122
Retrieving Column Details........................................................................................................................... 124
Retrieving Data from a Microsoft Excel Sheet........................................................................................... 125
Summary..................................................................................................................................................................128
Exercise ....................................................................................................................................................................129
Chapter 5: Describing Advanced JDBC Concepts.........................................131
Exploring the SQL 99 Data Types.........................................................................................................................132
The BLOB Data Type .................................................................................................................................... 132
Storing BLOB Values........................................................................................................................... 133
Reading BLOB Values......................................................................................................................... 135
The CLOB Data Type.................................................................................................................................... 136
Storing CLOB Values .......................................................................................................................... 137
Reading CLOB Values......................................................................................................................... 138
The Struct (Object) Data Type ..................................................................................................................... 140
Using User-Defined Object Types in Java to Represent Database Object Types......................... 140
Creating a JDBC UDT.......................................................................................................................... 141
Mapping the JDBC UDT..................................................................................................................... 141
Implementing UDT ............................................................................................................................. 141
Using the java.sql.Struct Interface ..................................................................................................... 145
The Array Data Type .................................................................................................................................... 146
The Ref Data Type......................................................................................................................................... 151
Working with the ROWID Type...........................................................................................................................151
Working with Batch Updates................................................................................................................................152
Using Batch Updates with the Statement Object ...................................................................................... 153
The Batch Update Methods................................................................................................................ 153
6. Table of Contents
x
The BatchUpdateException Exception.............................................................................................. 154
Using Batch Updates with the PreparedStatement Object ...................................................................... 156
Describing SQL/XML and XML support............................................................................................................157
Retrieving Auto Generated Keys..........................................................................................................................158
Working with RowSets in JDBC ...........................................................................................................................161
The Connected RowSets............................................................................................................................... 161
The Disconnected RowSets.......................................................................................................................... 161
Using the RowSet at Design Time............................................................................................................... 162
Setting the Properties of the RowSet Instance ................................................................................. 162
Working with RowSet Events ............................................................................................................ 162
Using RowSets at Run Time ........................................................................................................................ 162
Setting Parameter Values of a RowSet Object.................................................................................. 163
Executing RowSets .............................................................................................................................. 163
Traversing a RowSet............................................................................................................................ 163
Exploring Connection Pooling..............................................................................................................................163
Working with Connection Pool ............................................................................................................................165
Working with Transactions...................................................................................................................................166
Describing ACID Properties ........................................................................................................................ 166
Atomicity .............................................................................................................................................. 167
Consistency........................................................................................................................................... 167
Isolation................................................................................................................................................. 167
Durability.............................................................................................................................................. 167
Types of Transactions................................................................................................................................... 167
Performing Transaction Management........................................................................................................ 168
Describing the Wrapper Interface ........................................................................................................................171
The isWrapperFor() Method........................................................................................................................ 171
The unwrap() Method .................................................................................................................................. 171
Describing SQLException......................................................................................................................................171
Summary..................................................................................................................................................................173
Exercise ....................................................................................................................................................................174
Chapter 6: Understanding Java Servlet ..........................................................175
Understanding the Need for Server-Side Extensions ........................................................................................176
Introducing CGI......................................................................................................................................................176
Introducing Java Servlet ........................................................................................................................................178
Advantages of a Servlet................................................................................................................................ 178
New Features of Servlet 2.5.......................................................................................................................... 178
Exploring the Servlet Container ...........................................................................................................................180
Describing the Request Processing Mechanism........................................................................................ 180
Describing the Types of Servlet Container Configurations..................................................................... 180
7. Table of Contents
xi
The Standalone Container .................................................................................................................. 181
The In-Process Container.................................................................................................................... 181
The Out-Process Containers............................................................................................................... 182
Introducing the Servlet API...................................................................................................................................182
Describing the javax.servlet Package.......................................................................................................... 183
Describing the javax.servlet.http Package.................................................................................................. 184
Implementing a Servlet Object..............................................................................................................................185
The javax.servlet.Servlet Interface............................................................................................................... 185
The javax.servlet.ServletConfig Interface<H2>......................................................................................... 185
Understanding the Servlet LifeCycle ...................................................................................................................186
Describing the Stages of the Servlet LifeCycle .......................................................................................... 186
Loading a Servlet ................................................................................................................................. 186
Initializing a Servlet............................................................................................................................. 187
Handling Request................................................................................................................................ 187
Destroying a Servlet (End of service)................................................................................................ 189
Exploring the Servlet Life Cycle Methods ................................................................................................. 189
The init () method ................................................................................................................................ 189
The service( ) Method.......................................................................................................................... 189
The destroy () Method......................................................................................................................... 190
Developing the First Servlet Application ............................................................................................................190
Creating the home.html Page ...................................................................................................................... 190
Creating the LifeCycleServlet...................................................................................................................... 191
Creating the Deployment Descriptor ......................................................................................................... 191
Deploying Web Application........................................................................................................................ 192
Running the LifeCycle Application ............................................................................................................ 193
Understanding the Request Processing Workflow ............................................................................................194
Request Navigation....................................................................................................................................... 195
Request Delegation ....................................................................................................................................... 196
Working with the GenericServlet Class...............................................................................................................197
Exploring Methods of the GenericServlet Class ...................................................................................... 198
Using the GenericServlet Class .................................................................................................................. 199
Creating the Home.html Page............................................................................................................ 199
Developing the HelloServlet.java Servlet......................................................................................... 200
Deploying and Running the Application ......................................................................................... 200
Summary..................................................................................................................................................................201
Exercise ....................................................................................................................................................................202
Chapter 7: Understanding Request Processing and HTTP...........................203
Implementing the ServletRequest Interface........................................................................................................204
Managing the Servlet Object as a Throwaway Object.............................................................................. 204
8. Table of Contents
xii
Managing the ServletRequest Object Pool................................................................................................. 204
Working with Request Parameters............................................................................................................. 205
Creating the Login Form..................................................................................................................... 206
Creating the LoginServlet Servlet...................................................................................................... 206
Creating the Deployment Descriptor File......................................................................................... 208
Running the Application .................................................................................................................... 209
Working with Initialization Parameters ..............................................................................................................210
Exploring the Need for Initialization Parameters..................................................................................... 211
Retrieving Initialization Parameters........................................................................................................... 211
Handling Servlet Initialization Parameters ............................................................................................... 212
Creating the Home.html File.............................................................................................................. 212
Creating the InitParamsServlet Servlet............................................................................................. 212
Creating the Deployment Descriptor File......................................................................................... 213
Running the Application .................................................................................................................... 214
Working with Context Initialization Parameters................................................................................................216
Retrieving Context Initialization Parameters ............................................................................................ 216
Using Context Initialization Parameters .................................................................................................... 216
Creating the Home.html File.............................................................................................................. 217
Creating the Login.html File .............................................................................................................. 217
Creating the Register.html File .......................................................................................................... 218
Creating the RegistrationServlet Servlet........................................................................................... 219
Creating the LoginServlet Servlet...................................................................................................... 221
Creating the Deployment Descriptor File......................................................................................... 223
Running the Application .................................................................................................................... 225
Understanding ServletResponse...........................................................................................................................227
Understanding Request Dispatching...................................................................................................................228
Navigation...................................................................................................................................................... 229
Delegation ...................................................................................................................................................... 230
Dispatching the Request........................................................................................................................................230
Getting a RequestDispatcher object............................................................................................................ 230
The getRequestDispatcher() Method of ServletContext ................................................................. 230
The getNamedDispatcher() Method of ServletContext .................................................................. 231
The getRequestDispatcher() Method of ServletRequest................................................................. 231
Comparing the getRequestDispatcher() Methods of ServletContext and ServletRequest......... 231
Comparing the getRequestDispatcher() & getNamedDispatcher() Methods.............................. 232
Understanding the include() and forward() Methods of RequestDispatcher ....................................... 232
Describing the include() Method....................................................................................................... 232
Describing the forward() Method...................................................................................................... 234
Comparing the include() and forward() Methods........................................................................... 235
9. Table of Contents
xiii
Considering the Situations to use the include() and forward() Methods..................................... 236
Working with RequestDispatcher............................................................................................................... 236
Creating the Home.html File.............................................................................................................. 236
Creating the TestServlet1 Servlet....................................................................................................... 237
Creating the TestServlet2 Servlet....................................................................................................... 238
Creating the Deployment Descriptor File......................................................................................... 239
Running the Application .................................................................................................................... 240
Describing Request Attributes..............................................................................................................................242
Working with Request Attributes............................................................................................................... 242
Creating the Home.html File.............................................................................................................. 243
Creating the ValidationServlet Servlet.............................................................................................. 243
Creating the AddServlet Servlet ........................................................................................................ 244
Creating the SubServlet Servlet ......................................................................................................... 244
Creating the ResponseServlet Servlet ............................................................................................... 245
Creating the Deployment Descriptor File......................................................................................... 246
Running the Application .................................................................................................................... 247
Describing HTTP Basic ..........................................................................................................................................249
Describing HTTP Status Codes ................................................................................................................... 249
1XX – Informational ............................................................................................................................ 249
2XX – Success ....................................................................................................................................... 249
3XX – Redirection ................................................................................................................................ 249
4XX – Client Error................................................................................................................................ 250
5XX – Server Error ............................................................................................................................... 250
Describing the HttpServletRequest & HttpServletResponse Interfaces ..........................................................250
Working with HttpServletRequest ............................................................................................................. 251
Working with HttpServletResponse........................................................................................................... 251
Exploring the Methods for Response Headers ................................................................................ 252
Exploring the Methods for Buffering................................................................................................ 253
Comparing RequestDispatcher forward and sendRedirect........................................................... 253
Handling the HttpServletRequest and HttpServletResponse Interfaces ............................................... 254
Creating the Home.html File.............................................................................................................. 254
Creating the HttpServletRequestEx Servlet ..................................................................................... 254
Creating the Deployment Descriptor File......................................................................................... 255
Running the Application .................................................................................................................... 256
Describing HttpServlet...........................................................................................................................................258
The HttpServlet Lifecycle............................................................................................................................. 259
Summary..................................................................................................................................................................259
Exercise ....................................................................................................................................................................260
10. Table of Contents
xiv
Chapter 8: Handling Sessions in Servlet ........................................................261
Introducing Session Tracking ...............................................................................................................................262
Describing URL Rewriting ....................................................................................................................................263
Using Query String for URL Rewriting...................................................................................................... 263
Using Path Info for URL Rewriting ............................................................................................................ 263
Listing the Disadvantages of URL Rewriting............................................................................................ 264
Considering Situations to use URL Rewriting .......................................................................................... 264
Exploring Hidden Form Field...............................................................................................................................264
Listing the Advantages and Disadvantages of Hidden Form Field ....................................................... 265
Considering the Situations to use Hidden Form Fields ........................................................................... 265
Working with URL Rewriting and Hidden Form Field ....................................................................................265
Creating the SiteHome.html Page............................................................................................................... 265
Creating the Login.html Page...................................................................................................................... 266
Creating the Send.html Page ....................................................................................................................... 266
Creating the DriverConnection.java File.................................................................................................... 266
Creating the UserDAO.java File.................................................................................................................. 267
Creating the LoginServlet.java Servlet ....................................................................................................... 267
Creating the Mail.java File ........................................................................................................................... 269
Creating the MailsDAO.java File ................................................................................................................ 270
Creating the InboxServlet.java Servlet ....................................................................................................... 271
Creating the ViewMailServlet.java Servlet ................................................................................................ 272
Creating the SendReplyServlet.java Servlet............................................................................................... 274
Creating the Deployment Descriptor File.................................................................................................. 275
Creating the Database Tables ...................................................................................................................... 276
Creating the Directory Structure................................................................................................................. 277
Running the Application.............................................................................................................................. 277
Describing Cookies.................................................................................................................................................279
Listing the Advantages and Disadvantages of Cookies........................................................................... 280
Considering the Situations to use Cookies ................................................................................................ 280
Using Cookies .........................................................................................................................................................281
Creating the Home.html File ....................................................................................................................... 281
Creating the AddCookieServlet.java File................................................................................................... 281
Creating the GetCookieServlet.java File..................................................................................................... 282
Creating the web.xml File ............................................................................................................................ 282
Running the Application.............................................................................................................................. 283
Exploring HttpSession ...........................................................................................................................................284
Creating a Session Object............................................................................................................................. 285
Locating a Session Object Associated with the Current Request............................................................ 285
Difference between the getSession() and getSession(Boolean) Methods...................................... 285
11. Table of Contents
xv
Storing Information in a Session ................................................................................................................. 285
Attaching the Session Identity to the URLs............................................................................................... 286
Looking up Information in a Session.......................................................................................................... 287
Discarding Completed or Abandoned Sessions........................................................................................ 287
Listing the Advantages and Disadvantages of HttpSession.................................................................... 288
Considering the Situations to use HttpSession ......................................................................................... 288
Threading Issues of a Session............................................................................................................. 288
Sessions in a Clustered Environment................................................................................................ 288
Working with HttpSession....................................................................................................................................288
Creating the Login.html File........................................................................................................................ 289
Creating the DriverConnection.java File.................................................................................................... 289
Creating the UserDAO.java File.................................................................................................................. 290
Creating the Product.java File ..................................................................................................................... 290
Creating the ProductsDAO.java File .......................................................................................................... 291
Creating the LoginServlet.java File............................................................................................................. 291
Creating the UserHomeServlet.java File.................................................................................................... 292
Creating the GetProductsServlet.java File ................................................................................................. 293
Creating the AddProductServlet.java File ................................................................................................. 295
Creating the GetCartDetailsServlet.java File............................................................................................. 297
Creating the LogoutServlet.java File........................................................................................................... 298
Creating the web.xml File ............................................................................................................................ 299
Describing Servlet Context Attributes .................................................................................................................304
Context Attributes in a Distributed Container.......................................................................................... 304
Differences Between Parameters and Attributes............................................................................. 304
Describing Scopes of the Web Application Objects ...........................................................................................304
Exploring the Single Thread Model .....................................................................................................................305
Explaining the Need of Synchronization in Servlets................................................................................ 305
Implementing SingleThreadModel............................................................................................................. 306
Describing the ServletOutputStream Class.........................................................................................................307
Using ServletOutputStream......................................................................................................................... 307
Summary..................................................................................................................................................................309
Exercise ....................................................................................................................................................................310
Chapter 9: Implementing Filters, Listeners, and Wrappers.......................... 311
Exploring Filters......................................................................................................................................................312
Filter Interception Design Pattern............................................................................................................... 312
Filter API ........................................................................................................................................................ 313
The Filter Interface............................................................................................................................... 313
The FilterConfig Interface................................................................................................................... 314
The FilterChain Interface .................................................................................................................... 314
12. Table of Contents
xvi
Working With Filters .................................................................................................................................... 314
Creating the Home.html Page............................................................................................................ 315
Creating the TestServlet.java File ...................................................................................................... 315
Creating the MyFilter1.java File......................................................................................................... 315
Creating the MyFilter2.java File......................................................................................................... 316
Configuring the Filters Application .................................................................................................. 316
Running the Application .................................................................................................................... 318
Changes in Servlet 2.4 in Filter Configurations......................................................................................... 320
Using Filters with the forward( ) and include( ) Methods ............................................................. 320
Describing Listeners...............................................................................................................................................321
Need of Event Programming and Importance of Listeners..................................................................... 321
Types of Listeners ......................................................................................................................................... 321
Describing the Listener Interfaces............................................................................................................... 322
The ServletContextListener Interface................................................................................................ 323
The ServletContextAttributeListener Interface................................................................................ 327
The HttpSessionListener Interface..................................................................................................... 332
The HttpSessionAttributeListener Interface .................................................................................... 332
The HttpSessionBindingListener Interface....................................................................................... 337
The HttpSessionActivationListener Interface .................................................................................. 340
The ServletRequestListener Interface................................................................................................ 340
The ServletRequestAttributeListener Interface................................................................................ 341
Describing Wrappers .............................................................................................................................................341
Need of Wrappers......................................................................................................................................... 341
Types of Wrapper Classes............................................................................................................................ 341
The ServletRequestWrapper Class .................................................................................................... 342
The ServletResponseWrapper Class.................................................................................................. 342
The HttpServletRequestWrapper Class............................................................................................ 343
The HttpServletResponseWrapper Class ......................................................................................... 343
Using Wrappers............................................................................................................................................. 344
Creating the Home.html Page............................................................................................................ 344
Creating the TestServlet.java File ...................................................................................................... 344
Creating the MyRequestWrapper.java File...................................................................................... 345
Creating the MyResponseWrapper.java File.................................................................................... 345
Creating the MyWrapperFilter.java File........................................................................................... 346
Creating the Web.xml File.................................................................................................................. 346
Deploying and Running the Application ......................................................................................... 347
Applet to Servlet Communication........................................................................................................................348
An Example Using Applet in Servlet.......................................................................................................... 348
Summary..................................................................................................................................................................351
Exercise ....................................................................................................................................................................351
13. Table of Contents
xvii
Chapter 10: Introduction to JSP ..................................................................... 353
Understanding JSP ................................................................................................................................................. 354
Advantages of JSP over Servlets ................................................................................................................. 355
Introducing the Tag-Based Approach ........................................................................................................ 356
Describing the JSP Architecture .................................................................................................................. 357
JSP Model I architecture...................................................................................................................... 357
Describing the JSP Life-Cycle................................................................................................................................ 358
The Page Translation Stage.......................................................................................................................... 358
The Compilation Stage ................................................................................................................................. 360
The Loading & Initialization Stage ............................................................................................................. 360
The Request Handling Stage........................................................................................................................ 361
The Destroying Stage.................................................................................................................................... 361
Creating Simple JSP Pages..................................................................................................................................... 361
Summary.................................................................................................................................................................. 364
Exercise .................................................................................................................................................................... 364
Chapter 11: Working with JSP Basic Tags and Implicit Objects ................. 365
Exploring Scripting Tags ....................................................................................................................................... 366
Types of Scripting Tags ................................................................................................................................ 366
The Scriptlet Tag.................................................................................................................................. 366
The Declarative Tag............................................................................................................................. 367
The Expression Tag ............................................................................................................................. 367
Working with JSP Scripting Tags................................................................................................................ 368
Exploring Implicit Objects..................................................................................................................................... 370
Features of Implicit Objects ......................................................................................................................... 370
Types of Implicit Objects.............................................................................................................................. 370
The request Object ............................................................................................................................... 371
The response Object............................................................................................................................. 371
The out Object ...................................................................................................................................... 371
The page Object.................................................................................................................................... 371
The pageContext Object...................................................................................................................... 371
The application Object ........................................................................................................................ 371
The session Object................................................................................................................................ 371
The config Object ................................................................................................................................. 371
The exception Object ........................................................................................................................... 371
Working with Implicit Objects .................................................................................................................... 372
Exploring Directive Tags ....................................................................................................................................... 376
Types of Directive Tags................................................................................................................................ 377
The Page Directive Tag ....................................................................................................................... 377
The Include Directive.......................................................................................................................... 378
14. Table of Contents
xviii
The Taglib Directive ............................................................................................................................ 378
Working with JSP Directive Tags................................................................................................................ 379
Summary.................................................................................................................................................................. 382
Exercise .................................................................................................................................................................... 382
Chapter 12: Working with JavaBeans and Action Tags in JSP ................... 383
What is JavaBean?..................................................................................................................................................384
Advantages of using JavaBeans .................................................................................................................. 384
Action Tags..............................................................................................................................................................384
Describing the Include Tag .......................................................................................................................... 385
Difference Between Include Directive and Include Action............................................................ 385
Describing the Forward Tag ........................................................................................................................ 386
Describing the Param Tag............................................................................................................................ 386
name ...................................................................................................................................................... 387
value ...................................................................................................................................................... 387
Describing the useBean Tag......................................................................................................................... 390
Describing the Attributes of the <jsp:useBean> Tag....................................................................... 390
Using the <jsp:useBean> Tag Attributes .......................................................................................... 391
Generating Servlets with the <jsp:useBean> Tag ............................................................................ 392
Describing the setProperty Tag................................................................................................................... 393
name ...................................................................................................................................................... 393
property ................................................................................................................................................ 393
value ...................................................................................................................................................... 394
param .................................................................................................................................................... 394
Describing the getProperty Tag................................................................................................................... 395
The name Attribute ............................................................................................................................. 395
The property Attribute........................................................................................................................ 395
Plugin.............................................................................................................................................................. 395
Params ............................................................................................................................................................ 396
Fallback........................................................................................................................................................... 396
Attribute ......................................................................................................................................................... 396
Body................................................................................................................................................................ 397
Element........................................................................................................................................................... 397
Text.................................................................................................................................................................. 398
Declaring a Bean in a JSP.......................................................................................................................................398
Creating a Bean.............................................................................................................................................. 398
Declaring the Bean in a JSP.......................................................................................................................... 399
Accessing the Bean Properties..................................................................................................................... 399
Generating Dynamic Content within a JSP................................................................................................ 400
Deploying and Running Application ......................................................................................................... 401
15. Table of Contents
xix
Summary..................................................................................................................................................................403
Exercise ....................................................................................................................................................................404
Chapter 13: Enhancing the JSP Tags Support .............................................. 405
Custom Tags............................................................................................................................................................406
Need of Custom Tags ................................................................................................................................... 406
Elements of Custom Tags............................................................................................................................. 407
Tag Library Descriptor........................................................................................................................ 407
Tag Handler.......................................................................................................................................... 408
The Tag Extension API...........................................................................................................................................410
Empty Tags..............................................................................................................................................................411
Empty Tag Handler Life Cycle.................................................................................................................... 412
Using Empty Tags......................................................................................................................................... 412
Body Content Tag Interface...................................................................................................................................420
Body Tag Handler Life Cycle ...................................................................................................................... 420
Using BodyContent Tag .............................................................................................................................. 421
Iteration tag Interface.............................................................................................................................................429
Iteration Tag Handler Life Cycle................................................................................................................. 429
Simple Tags .............................................................................................................................................................433
Life Cycle of Simple Tag Handlers ............................................................................................................. 433
Differences between Simple Tag and Classic Tag Handlers ................................................................... 435
The TryCatchFinally Interface ..............................................................................................................................435
Summary..................................................................................................................................................................436
Exercise ....................................................................................................................................................................436
Chapter 14: Understanding JSP Expression Language ............................... 437
Basic Syntax of using EL........................................................................................................................................438
Types of EL Expressions............................................................................................................................... 438
Immediate and Deferred Expressions............................................................................................... 439
Value Expressions................................................................................................................................ 439
Method Expressions............................................................................................................................ 440
Tag Attribute Types...................................................................................................................................... 440
Resolving EL Expressions ............................................................................................................................ 441
Describing the EL Resolver Classes................................................................................................... 441
EL Operators.................................................................................................................................................. 443
Types of EL Operators ........................................................................................................................ 443
An Example of Using EL Operators.................................................................................................. 444
Implicit EL Objects........................................................................................................................................ 445
Example 1 of Using Implicit EL Objects ........................................................................................... 447
Example 2 of Using Implicit EL Objects ........................................................................................... 449
16. Table of Contents
xx
Introducing Functions with EL.............................................................................................................................451
Using EL Functions ................................................................................................................................................451
Summary..................................................................................................................................................................453
Exercise ....................................................................................................................................................................453
Chapter 15: Implementing Internationalization ............................................. 455
Introducing Internationalization ..........................................................................................................................456
Java and Internationalization................................................................................................................................456
Describing the Locale Class ......................................................................................................................... 456
Parameters of the Locale Object......................................................................................................... 457
Using the Locale Class ........................................................................................................................ 457
Describing the ResourceBundle Class ........................................................................................................ 458
The PropertyResourceBundle Class.................................................................................................. 459
The ListResourceBundle Class........................................................................................................... 461
Internationalizing Web Applications...................................................................................................................463
Creating the JSP Views................................................................................................................................. 464
Creating the index.html View............................................................................................................ 464
Creating the Home.jsp View .............................................................................................................. 464
Creating the I18NServlet Class.................................................................................................................... 465
Creating the Resource Bundles.................................................................................................................... 465
Configuring the Application........................................................................................................................ 466
Designing the Application Directory Structure ........................................................................................ 466
Running the Application.............................................................................................................................. 467
Summary..................................................................................................................................................................468
Exercise ....................................................................................................................................................................468
Chapter 16: Working with JSP Standard Tag Library (JSTL)....................... 469
Describing JSTL Core Tags....................................................................................................................................470
General-Purpose Tags .................................................................................................................................. 470
The <c:out> tag .................................................................................................................................... 470
The <c:set> Tag .................................................................................................................................... 472
The <c:remove> Tag............................................................................................................................ 473
The <c:catch> Tag................................................................................................................................ 473
Conditional and Looping Tags.................................................................................................................... 473
Types of Conditional and Looping Tags .......................................................................................... 473
Using Conditional and Looping Tags............................................................................................... 475
Networking Tags........................................................................................................................................... 480
The <c:import> Tag............................................................................................................................. 480
The <c:url> Tag.................................................................................................................................... 480
The <c:redirect> Tag............................................................................................................................ 481
17. Table of Contents
xxi
The <c:param> Tag.............................................................................................................................. 481
Describing the JSTL SQL Tags ..............................................................................................................................481
Types of JSTL SQL Tags ............................................................................................................................... 481
The <sql:query> Tag............................................................................................................................ 482
The <sql:update> Tag ......................................................................................................................... 482
The <sql:param> Tag .......................................................................................................................... 482
The <sql:dateParam> Tag................................................................................................................... 483
The <sql:setDataSource> Tag............................................................................................................. 483
The <sql:transaction> Tag .................................................................................................................. 483
Using JSTL SQL Tags.................................................................................................................................... 483
JSTL Formatting Tags.............................................................................................................................................486
Basic Formatting Tags .................................................................................................................................. 486
Types of Basic Formatting Tags......................................................................................................... 486
Using Basic JSTL Formatting Tags .................................................................................................... 488
Number Formatting Tags............................................................................................................................. 490
Types of Number Formatting Tags ................................................................................................... 490
Using Number Format Tags............................................................................................................... 491
Date Formatting Tags ................................................................................................................................... 494
Types of Date Formatting Tags.......................................................................................................... 494
Using Date Formatting Tags .............................................................................................................. 495
Time Zone Formatting Tags......................................................................................................................... 497
Types of Time Zone Formatting Tags............................................................................................... 497
Using TimeZone Formatting Tags..................................................................................................... 497
JSTL XML Tags .......................................................................................................................................................499
XML Core Tags.............................................................................................................................................. 499
The <x:parse> Tag ............................................................................................................................... 500
The <x:out> Tag................................................................................................................................... 500
The <x:set> Tag.................................................................................................................................... 500
XML Flow Control Tags............................................................................................................................... 500
The <x:if> Tag ...................................................................................................................................... 501
The <x:choose> Tag............................................................................................................................. 501
The <x:when> Tag............................................................................................................................... 501
The <x:otherwise> Tag........................................................................................................................ 501
The <x:forEach> tag ............................................................................................................................ 501
XML Transformation Tags........................................................................................................................... 502
The <x:transform> Tag........................................................................................................................ 502
The <x:param> Tag ............................................................................................................................. 502
Implementing JSTL Tags .......................................................................................................................................502
Summary..................................................................................................................................................................506
Exercise ....................................................................................................................................................................506