131
Abstract Abstract The tasks of a district collector are becoming more tedious because of the growing number of people applying for everything to the collectorate office. The collector is the highest responsible officer who has to take care of everything in his district. As such, a software to assist his duties and automates most of the tasks of collectorate is highly appreciated. District collectorate management system is one such website which helps to improve the productivity of district collector’s office people but also it helps the citizens to understand the status of their jobs pending the office. Types of users: 1) The administrator who is either the collector directly himself or the management staff at his office who takes decisions on various tasks whether to issue them or not. 2) The users who have applied for some certificates or projects on which the decisions to be taken by the collectorate. The users can monitor the status from time to time the proceedings in his/her task. 3) Police persons who have to visit the users who applied for a passport, verify their address and other history and submit a report to the collectorate. District Collectorate

District Collector Ate

Embed Size (px)

Citation preview

Page 1: District Collector Ate

Abstract

Abstract

The tasks of a district collector are becoming more tedious because

of the growing number of people applying for everything to the

collectorate office. The collector is the highest responsible officer

who has to take care of everything in his district. As such, a

software to assist his duties and automates most of the tasks of

collectorate is highly appreciated. District collectorate management

system is one such website which helps to improve the productivity

of district collector’s office people but also it helps the citizens to

understand the status of their jobs pending the office.

Types of users:

1) The administrator who is either the collector directly himself or

the management staff at his office who takes decisions on

various tasks whether to issue them or not.

2) The users who have applied for some certificates or projects on

which the decisions to be taken by the collectorate. The users

can monitor the status from time to time the proceedings in

his/her task.

3) Police persons who have to visit the users who applied for a

passport, verify their address and other history and submit a

report to the collectorate.

Tasks handled by this system:

1. Issue of various certificates to the applicants.

2. Issue of passports.

3. Verification of details of person who applied for passport.

4. Placing the tenders’ information.

5. Allotment of tenders to eligible people.

District Collectorate

Page 2: District Collector Ate

Abstract

SYSTEM ANALYSIS

Existing system

The present collectorate system is operating their transactions

manually for entering the applicant data regarding any certificate,

passing the file to higher authority, verifying the applicant details,

approve the certificate. As and when a applicant wants to know the

status of the certificate to which he has applied then he needs to

come to collectorate and check the status manually which is a time

waste process. Maintaining all the applicant details, their address

details, certificate details etc manually are a tedious process. It does

n’t provide proper security also.

If an applicant applies for a passport then the collectorate has

to enter the applicant details in the database and assign it

appropriate police station for further verification. Immediately the

responsible police station has to verify the candidate details and

send the feedback to collectorate then the passport will be issued to

the candidate from collectorate through post.

For completing works in the district the collectorate has to

announce the contract work details manually to all the registered

contractors for accepting the tenders from the contractors. After

accepting the tenders from the contracts the collectorate has to

decide to which contractor we have to allot this work based on the

amount they have quoted and the no of the days they have quoted

to complete the work.

Limitations of the existing system

District Collectorate

Page 3: District Collector Ate

Abstract The existing system employs a lot of man-hours both for

preparing the entering the data, accepting the tenders, checking the

details and announcing the status.

This time consuming evaluation coupled by the huge

manpower requirement may also lead to erroneous results. To

maintain the personal details of the candidate in a file manually

may result in some loss of data and difficulty to store.

An employee of the collectorate has to enter the applicant

data and move the file to the responsible authority manually is a

time taking process. Meanwhile if the applicant wants to know the

status of his file then he needs to come to the come to collectorate

office manually and ask the collectorate staff.

The drawbacks in the existing system are as follows:

More paper work

Loss in Data

Less Security

Time Delay

More Clerical Work

Human Fatigue

Fear of environment

Chance for errors

Delay of results

Proposed System

The proposed system will be developed on client/server

architecture. The user can logon to the internet and view the

collectorate from anywhere.

District Collectorate

Page 4: District Collector Ate

Abstract On applying, each applicant is assigned a unique id and a

password. The user can logon to the server with his Id and check the

status of his file. All the applicant files are stored at a centralized

database. Files can also move from desk to another very easily.

After completion of the verification, the certificate status will be

updated so that the applicant get the status from

online. It can also store work details, registered contractors details,

tenders and their final allotment details at a centralized location

with proper security. The system also generates a list of contractors

and allows the collectorate to decide about to whom the current

work has to be allotted very easily.

The system also allows the passport applicant candidate to

check the current status of the passport which includes police

enquiry, verification and delivery. One department can move the file

to another department and update the status in the previous

department.

The objectives of the system are as follows:

1. The applicant has to enter the applicant details for applying

the certificate.

2. Provide an efficient mechanism to move the files from one

department to another very easily. The department person

needs to update the current status of the file.

3. All the details needs to be maintained in the database.

4. Only the authorized person can approve the file and store

the details inside the database.

5. All the tenders are to be accepted from the registered

contractors for a specific work between specific dates and

show all the tenders in a tabular format

6. The time limit will be maintained.

District Collectorate

Page 5: District Collector Ate

Abstract 7. Reports will be generated as and when needed.

Merits of the Proposed System

Automate all collectorate transactions

Reduce Paper Work

Immediate Accessing of Details

High Security

Providing Accurate Information

Providing Overall Reliability

Easy to use, effective and efficient

System Specifications

Hardware specifications

Processor : P IV 1.7 GHz

Memory : 256 Mb

RAM

Hard Disk Capacity : 40Gb

District Collectorate

Page 6: District Collector Ate

Abstract Floppy Disk Capacity : 1.44Mb

Display Card : SVGA

Software specifications

Operating System : Windows 2000

Web Application Tools : JavaScript, JSP,

Apache Tomcat 5.0.25

Internet Tools : Microsoft FrontPage

Express

Browsers : Internet Explorer 6.0

Back End : Oracle8i

Documentation : Ms Word 2000

District Collectorate

Page 7: District Collector Ate

Abstract

Feasibility Study

Feasibility analysis reduces the development risks. The major

areas considered in feasibility analysis are as follows.

The feasibility study concerns with the considerations made to

verify whether the system is fit to be developed in all terms. Once

an idea to develop software is put forward the question that arises

first will pertain to the feasibility aspects. It involves developing and

understanding of the selected program. It calls for decision on the

data sources, study approaches, instruments available. The data is

tabulated, analyzed and there by various interpretations are made

finally based upon the analysis. There are different aspects in the

feasibility study.

1) Economic Feasibility

2) Technical feasibility

3) Operational Feasibility

Economic Feasibility

A cost benefit analysis is made up for the project. The main

component considered in economic feasibility is extra money to be

expended if the District Collectorate System component is to be

installed to run the server. But there is no problem to the district

collectorate people as it is already equipped with the required

hardware and software configurations. The cost benefits in the

system are reduced manual cost to a great extent, reduced typical

examination conduction and reduced stationary purchasing cost.

Technical feasibility

District Collectorate

Page 8: District Collector Ate

Abstract The new system District Collectorate System needs any

compatible web browser and a web server to run the system. The

proposed system will be implemented in Java. All the required

hardware and software are available with the organization. So the

project can be developed with the exiting software. Hence the

project is technically feasible.

Operational Feasibility

The project developed is highly user interactive application

and web based. So it is highly operational. It is very simple to

operate and even a novice person can use this system very easily.

Little bit of training is enough for the user. No complicated

command set is to be remembered or memorized. The system is

fully operationally feasible.

From the feasibility study it has been derived that District

Collectorate System is fully (economically, technically and

operationally) feasible

Modules:

Administrative Module: Administrator logs into the system, and can do the following:

He can view the status and details of all types of certificates like

Birth certificates, Death certificates, Widow certificates, Income

certificates, Residence certificates, Domicile certificates, Minority

certificates, and Caste certificates. After viewing the details, he can

either approve or decline the issue of the certificate. He can view

the details of all passport applicants and he will forward that

applicant information to appropriate police station for verification.

He can also deliver the passport to the applicant after the

verification and change the status of the application. He can create

District Collectorate

Page 9: District Collector Ate

Abstract logins for the registered contractors, he can post the contract

details in the collectorate site, he can accept the tenders and he

can allot that work to a contractor.

Users Module: The users are people who applied for various

certificates like Birth certificates, Death certificates, Widow

certificates, Income certificates, Residence certificates, Domicile

certificates, Minority certificates, and Caste certificates. He can

apply for the certificate by simply filling in the form and then an id

number is allotted to his application. Later, He has to type the id

number of his certificate to view the status and whether it has been

issued or not. The users (contractors) can also view the details of

the tenders and post the tenders. The users (passport applicants)

can apply for the passport from online and he can view the status of

the passport.

Police Module: Police persons should go and verify the address

and history of the person who applied for passport. For this, they

log into this site and see the information of the applicant. Then they

physically verify the details of the applicant and submit a report

through the site. Based on this, a decision is taken by the

Administrator regarding to issue the certificate or not.

About Software:

Technical Notes – About Software

HTML

HTML stands for Hyper Text Language. Hypertext is ordinary

text that has been dresses up with extra features, such as

District Collectorate

Page 10: District Collector Ate

Abstract formatting, images, multimedia and links to other documents.

Markup is the process of talking ordinary test and adding extra

symbols. Language is actually a key point to remember about HTML.

The hypertext markup language (HTML) is a simple markup

language. Used to create a hypertext documents that are portable

from one platform to another HTML documents are SGML (Standard

generalized mark up language) documents with generic semantics

that are appropriate for representing information from a wide range

of applications.

It has its own syntax, slag and rules for proper

communication. HTML is neither a page layout language nor a

printing language. The only thing HTML does is classifying parts of

our document so that a browser can display it correctly.

A set of instructions embedded in a document is called mark

up language. These instructions describe what the document text

means and how it should look like in a display. Hyper Text Mark Up

language (HTML) is the language used to encode World Wide Web

documents. It is universal language for classifying the function of

different sections of a Document. It is used to define the different

parts of our page. HTML is designed to Work on a wide variety of

platforms and also to work on a variety of graphical workstations.

The idea behind HTML is that if we mark up our

document by indicating the parts of our document of function, then

should be able to trust that document will be attractively and

correctly displayed by any browser on any computer anywhere in

the World.

Advantages

Flexibility

District Collectorate

Page 11: District Collector Ate

Abstract We are not depending on a particular piece of software that

may not available to you.

Deeper Understanding

You will have much better concept of the structure of your

page and understanding of why it works the way it does, because

you build the page from the ground up.

Trouble Shooting

Since you wrote the HTML, you will be able to troubleshoot it

efficiently and have a better idea of what techniques to try if some

things not working.

Price

Using HTML does not cost you a cent. There are no expensive

licenses to buy and no annoying upgrades to purchase.

Independence

You’re not stuck to any one vendor or program, you don’t

have to worry about bugs in a particular editing program or any

companies going out of business and leaving you standard.

Structure of HTML

HTML elements perform a defined task. HTML uses two types

of elements

Empty Tags

Container Tags

Empty tags represent formatting constricts such as line

breaks and horizontal rules. Container tags define a section of text,

District Collectorate

Page 12: District Collector Ate

Abstract formats and dot all of the selected text. A container tag has both a

beginning and an ending.

HTML Layout

An HTML document consists of text, which comprises the

content of the document and tags, which, defines the structure, and

appearance of the document. The structure of an HTML document is

simple, consists of outer <HTML> tag enclosing the document

header and body

<HTML>

<HEAD>

<TITLE>the title of HTML document</TITLE>

</HEAD>

<BODY>

This is where the actual HTML documents Text lies, which is

displayed in the browser

</BODY>

</HTML>

Each document has a head and body delimited by the

<HEAD> and <BODY> tag. The head is where you give your HTML

document a title and where you indicate other parameters the

browser may use when displaying the document. This includes the

text for displaying the text. Tag also

references special and indicates the hot spots that link your

document to other documents.

HTML Forms

Creating a form usually involves two independent steps:

Creating the layout for the form itself and then writing a script

District Collectorate

Page 13: District Collector Ate

Abstract program on the server side to process the formation you get back

from a form.

To create a form, You use the <FORM> tag. Inside the

opening and closing FORM tags are each of the individual form

elements plus any other HTML content to create a layout for that

form.

The opening tag of the FORM element usually includes the

attributes: METHOD and ACTION. The METHOD attributes can be

either GET or POST which determines how your form data is sent to

the script to process it.

The ACTION attribute is a pointer to the script that

processes the form on the server side. The ACTION can be included

by a relative path or by a full URL to a script on your server or

somewhere else. For example, the following <FORM> tag would call

a script called form-name in cgi-bin directory on server

www.myservser.com

<FORM Method= post

action=http://www.mytservser.com/cgi-bin/form-name.pl>

……………….

</FORM>

METHOD Attribute

The other required attribute for the <form> tag sets the

methods by which the browser form’s data to the server for

processing. There are two ways: the POST method and GET method.

With POST method, the browser sends the data in two steps: the

browser first contacts the form-processing server specified in the

action attributes, and once contact is made, sends the data.

District Collectorate

Page 14: District Collector Ate

Abstract The GET method in the other hand, contacts the form

processing server and sends the form data in a single transaction

step: the browser appends the data to the form’s action URL,

separated by the question mark (?) character.

Java

Java was conceived by James Gosling, Patrick

Naughton, Chriswarth, Ed Frank and Mike Sheridan at Sun Micro

Systems incorporation in 1991. It took 18 months to develop e the

first working version. This language was initially called “OAK”, but

was renamed “JAVA” in 1995. Before the initial implementation of

OAK in 1992 and the public announcement of Java in 1995, many

more contributed to the design and evolution of the language.

Java is a powerful but lean object oriented programming language .It

has generated a lot of excitement because it makes it possible to

program for Internet by creating applets, programs that can be

embedded in web page. The context of an applet is limited only by

one’s imagination. For example, an applet can be animation with

sound, an interactive game or a ticker tape with constantly updated

stock prices. Applets can be just little decorations to liven up web

page, or they can be serious applications like word processors or

spreadsheet.

But Java is more than a programming language for writing applets.

It is being used more and more for writing standalone applications

as well. It is becoming so popular that many people believe it will

become standard language for both general purpose and Internet

programming.

There are many buzzwords associated with Java, but because of its

spectacular growth in popularity, a new buzzword has appeared

ubiquitous. Indeed, all indications are that it will soon be

everywhere.

District Collectorate

Page 15: District Collector Ate

Abstract Java builds on the strength of C++. It has taken the best features of

C++ and discarded the more problematic and error prone parts. To

this lean core, it has added garbage collection (automatic memory

management), multi-threading (the capacity for one program to do

more than one thing at a time), security capabilities. The result is

that Java is simple, elegant, powerful and easy to use.

Java is actually a platform consisting of three components.

Java programming language.

Java library of classes and interfaces.

Java virtual Machine.

There are many reasons why java is preferable and they are

described as follows.

Simple

Java was designed to be easy for the professional programmer

to learn and use effectively. Java will be even easy if we already

thorough in the concept of object oriented. Some of confusing

concepts are left out of java or implemented in a cleaner, more

approachable manner.

Object Oriented

The Java programming language is object oriented, which

makes program design focus on what you are dealing with rather

than on how you are going to do something. This makes it more

useful for programming in sophisticated projects because one can

break the things down into understandable components. A big

benefit is that these components can then be reused.

Object oriented languages use the paradigm of classes. In

simple term, a class includes both the data and the functions to

District Collectorate

Page 16: District Collector Ate

Abstract operate on the data. You can create an instance of a class, also

called an object, which will have all the data members and

functionality of its class. Because of this, you can think of a class as

being like template, with each object being a specific instance of a

particular type of class.

The class paradigm allows one to encapsulate data so that

those using the data cannot see specific data values and function

implementation. Encapsulation makes it possible to make the

changes in code without breaking other programs that use that

code. If for example the implementation of a function is changed,

the change is invisible to the another programmer who invokes that

function, and it does not affect his/her program, except hopefully to

improve it.

Java includes inheritance, or the ability to derive new classes

from existing classes. The derived class, also called a subclass,

inherits all the data and functions of the existing class, referred to

as the parent class. A subclass can add new data members to those

inherited from the parent class. As far as methods are concerned,

the subclass can reuse the inherited methods, as it is, change them,

and/or add its own new methods.

Portable

One of the biggest advantages Java offers is that it is portable. An

application written in Java will run on all the major platforms. Any

computer with a Java based browser can run the applications or

applets written in the Java programming language. A programmer

no longer has to write one program to run on a Macintosh, another

program to run on a Windows machine, still another to run on UNIX

machine, and so on. In other words, with Java, developers write

their programs only once. The virtual machine is what gives Java is

District Collectorate

Page 17: District Collector Ate

Abstract cross platform capabilities. Rather than being compiled into

machine language, which is different for each operating systems

and computer architecture, Java code is compiled into byte codes.

With other languages, the program code is compiled into a language

the computer can understand. The problem is that other computers

with different machine instruction set cannot understand that

language. Java code on the other hand is compiled into byte code

rather than a machine language. These byte codes go to the Java

virtual machine, which executes them directly or translates them

into the language that is understood by the machine running it.

In Summary, these means that with the JDBC API extending Java, a

programmer writing Java code can access all the major relational

databases on any platform that supports the Java virtual machine.

Robust

The multi platform environment of the web places

extraordinary demands on a program, because the program must

execute reliably in a variety of systems. Thus, the ability to create

robust programs were given a high priority in the design of java.

However, it also checks our code at run time. In fact, many space

hard-to-down bugs that often turn up in hard-to reproduce run time

situations are simply impossible to create in java.

To better understand how java is robust, two of the reasons

are mainly considered for program failure memory management

mistakes and mishandling exceptional conditions. Memory

management can be a difficult, tedious task in traditional

programming environments. Java virtually eliminates these

problems by managing memory allocation and deal location.

Exceptional conditions in traditional environment often arise in

situations such as division by zero or “file not found” and they must

District Collectorate

Page 18: District Collector Ate

Abstract be managed with clumsy and hard-to-read constructs. Java helps in

this area by providing object-oriented exception handling.

Security

Every time that we download a “normal” program, we are

risking a viral infection. Prior to java most users did not download

executable programs frequently, and those who did scanned them

for viruses prior to execution. Even so, most users still worried about

the possibilities of infecting their systems with a virus.

In addition to viruses, another type of malicious program

exists that must be guarded against. This type of program can

gather private information, such as credit card numbers, bank

account balances and passwords, by searching the contents of our

computer’s local file system. Java answers both of this concern by

providing a “firewall” between a networked application and our

computer.

Multithreaded

Java was designed to meet the real-world requirement of

creating interactive, networked programs. To accomplish this, java

supports multithreaded programming, which allows us to write

programs that do many things simultaneously. The java run-time

system comes with an elegant yet sophisticated solution for multi

process synchronization that enables us to construct smoothly

running interactive systems.

Interpreted and high performance

Java enables the creation of cross-platform programs by

compiling into an intermediate representation called java byte code.

This code can be interpreted on any system tat provides a java

Virtual Machine. Most previous attempts at cross-platform solutions

District Collectorate

Page 19: District Collector Ate

Abstract have done so at the expense of performance. Other interpreted

system, such as BASIC, Tcl and PEAL, suffer from almost

insurmountable performance deficits. Java, however, was designed

to perform well on very low power CPUs.

Distributed

Java is built with network communications in mind. It has a

comprehensive library of routines for dealing with network protocols

such as TCP/IP, HTTP and FTP. As a result, Java application can open

and access objects across the Internets with the same ease that

programmers normally expects while accessing a local file system.

You don’t have to worry about implementing the details of network

yourself; Java comes with everything needed for truly distributed

computing.

Dynamic

Fundamentally, distributed computing environment must be

dynamic Java was designed to adapt in a constantly evolving

environment. It is capable of incorporating new functionality regard

less of where that functionality comes from-the local computer

system, the local and wide area networks, and the internet are all

potential contributors.

Garbage Collection

Automatically takes care of allocating and de-allocating memory, a

huge potential source of errors. If an object is no longer being used

(has no references to it), then it is automatically removed from

memory, or “Garbage Collected”. Programmers don’t have to keep

track of what has been allocated and de-allocated them, which

District Collectorate

Page 20: District Collector Ate

Abstract makes their job a lot easier, but more importantly it stops memory

leaks.

No Pointers

Eliminates big source errors. By using object references instead of

memory pointers, problems with pointer arithmetic are eliminated,

and problems with inadvertently accessing the wrong memory

address are greatly reduced.

Simplicity

Makes Java easier to learn and use correctly. Java keeps it simple

by having just one way to do something instead of having several

alternatives, as in some languages. Java also stays lean by not

including multiple inheritance, which eliminates the errors and

ambiguity that arise when you create a subclass that inherits from

two or more classes.

To replace capabilities, multiple inheritance provides, Java lets you

add functionality to a class through the use of interfaces.

Java script

JavaScript is one of the easy-to-use scripting languages

used with HTML pages to increase the functionality and interaction

between both client and server. Netscape developed it with Sun’s

Java language.

District Collectorate

Page 21: District Collector Ate

Abstract JavaScript is a set of programming commands and

instruction that can be used to enhance the way a web page

operates. By incorporating JavaScript commands into a web page,

we can programmatically alter the way the page looks, insert or

delete parts of contents depending upon the system requirements,

control the web server operations, communicate with the database

on the web and so on.

With JavaScript, we can create dynamic HTML pages that

process our inputs maintain persistent data using special objects,

files and relational databases. From the JavaScript live connect

functionality, our applications can access Java and CORBA

distributed –object applications. For high-level performance of web

page JavaScript and Client side JavaScript, we can perform action by

using the same core language with extra such as the predefined

objects and functions only relevant to run Java Script on server.

The client side JavaScript encompasses the core

JavaScript language plus extras such as the objects only relevant to

run JavaScript in a browser. The client JavaScript is also called

Navigator JavaScript. JavaScript also traps user events. So programs

can be developed for such events. This is an interpreter based

language and source code files are directly executed at run time.

JavaScript includes built in objects related to the current windows

and documents as well as objects such as Math, String and Data

functions respectively and properties.

JDBC

JDBC is a Java TM API for executing SQL statements. It consists

of a set of classes and interfaces that are written in the Java

programming language that makes it easy to sent SQL statements

to virtually any relational database. In other words, with the JDBC

API, it isn’t necessary to write one program to access a Sybase

District Collectorate

Page 22: District Collector Ate

Abstract database, any other program to access an Oracle database, another

to access Informix database, and so on. One can write a single

program using JDBC API and the program will be able to send SQL

statements to appropriate database. And with a program written in

Java, one also does not to worry about writing different programs to

run on different platforms. The combination of Java and JDBC lets a

programmer writes it once and run it anywhere.

Java, being robust, secure, easy to understand, easy to use,

and automatically downloadable on a network, is an excellent

language basis for database applications. JDBC is the mechanism for

Java applications to talk to variety of different databases. JDBC

extends what you can do in Java. For example, with Java and JDBC

API it is possible to publish a web page containing an applet that

uses information obtained from a remote database. With more and

more programmers using Java the need for easy database access

from Java is continuing to grow.

What does JDBC do?

Simply put, JDBC makes it possible to do three things:

Establishes the connection to databases.

Send SQL statements.

Process the results.

JDBC is a low-level API and a base for Higher-level API. JDBC is

a low-level interface, which means that it is used to invoke SQL

commands directly .It works very well in this capacity and is easy to

use than any other database connectivity API’s. But it was designed

also to be a base upon which to build higher-level interfaces and

tools. A higher-level interface is user-friendly using a more

District Collectorate

Page 23: District Collector Ate

Abstract understandable or more convenient API that is translated behind the

scenes into a low-level interface such as JDBC.

JDBC and ODBC:

At this point, Microsoft’s ODBC (open database connectivity)

API is probably the most widely used interface for accessing

relational databases. It offers the ability to connect to almost all

databases on all most platforms. So why not just use ODBC from

Java? The answer is that you can use ODBC from Java, but this is

best done with the help of JDBC in the form of JDBC-ODBC Bridge.

“Why do you need JDBC?”

There are several answers to this question:

ODBC is not appropriate for direct use from Java because it

uses a c interface. Calls from Java to native C code have a

number of drawbacks in the security, implementation,

robust ness and automatic portability of applications.

A literal translation of the ODBC C API into a Java API would

not be desirable. For example, Java has no pointers and

ODBC makes copious use of them. You can think of JDBC as

ODBC translated into object oriented interface that is

natural for Java programmers.

ODBC is hard to learn. It mixes simple and advanced

features together and it has complex options even for

simple queries. JDBC on the other hand is designed for a

wide range of programmers and kept simple things simple.

District Collectorate

Page 24: District Collector Ate

Abstract The big difference is that JDBC builds on and reinforces the

style and virtues of Java and of course, it is easy to use.

The JDBC API supports both two-tier and three-tier models

for database access. The JDBC API is a natural choice for

Java developers because it offers easy database access for

Java applications and applets.

Java Soft provides three JDBC product components as part of the

Java Developer’s Kit (JDK).

JDBC Driver manager.

JDBC driver test suit, and

JDBC-ODBC Bridge.

The JDBC driver manager is the backbone of JDBC

architecture. It actually is quite small and simple, its primary

function is to connect Java applications to the correct JDBC driver

and then get out of the way.

The JDBC driver test suit provides some confidence that JDBC

drivers will run your program. It tests that a JDBC driver implements

all of the JDBC classes and methods and that it provides the Entry

Level SQL functionality required for JDBC compliance.

The JDBC-ODBC Bridge allows ODBC drivers to be used as JDBC

drivers. It was implemented as way to get off the ground quickly,

and long term will provide a way to access some of the less popular

DBMS if JDBC are not implemented.

Oracle

Oracle is a relational database management system, which

organizes data in the form of tables. Oracle is one of many database

servers based on RDBMS model, which manages a seer of data that

District Collectorate

Page 25: District Collector Ate

Abstract attends three specific things-data structures, data integrity and data

manipulation.

With oracle cooperative server technology we can realize the

benefits of open, relational systems for all the applications. Oracle

makes efficient use of all systems resources, on all hardware

architecture; to deliver unmatched performance, price performance

and scalability. Any DBMS to be called as RDBMS has to satisfy

Dr.E.F.Codd’s rules.

Features of Oracle

PortableThe Oracle RDBMS is available on wide range of platforms

ranging from PCs to super computers and as a multi user loadable

module for Novel NetWare, if you develop application on system you

can run the same application on other systems without any

modifications.

CompatibleOracle commands can be used for communicating with IBM

DB2 mainframe RDBMS that is different from Oracle, that is Oracle

compatible with DB2. Oracle RDBMS is a high performance fault

tolerant DBMS, which is specially designed for online transaction

processing and for handling large database applications.

Multithreaded Server ArchitectureOracle adaptable multithreaded server architecture delivers

scalable high performance for very large number of users on all

hardware architecture including symmetric multiprocessors (sumps)

and loosely coupled multiprocessors. Performance is achieved by

eliminating CPU, I/O, memory and operating system bottlenecks and

by optimizing the Oracle DBMS server code to eliminate all internal

bottlenecks.

District Collectorate

Page 26: District Collector Ate

Abstract Oracle has become the most popular RDBMS in the market

because of its ease of use

Client/server architecture.

Data independence.

Ensuring data integrity and data security.

Managing data concurrency.

Parallel processing support for speed up data entry and

online transaction processing used for applications.

DB procedures, functions and packages.

Dr.E.F.Codd’s Rules

These rules are used for valuating a product to be called as

relational database management systems. Out of 12 rules, a

RDBMS product should satisfy at least 8 rules + rule called rule 0

that must be satisfied.

RULE 0 : Foundation Rule

For any system to be advertised as, or claimed to be relational

DBMS should manage database with in it self, with out using

an external language.

RULE 1 : Information Rule

All information in relational database is represented at logical

level in only one way as values in tables.

RULE 2 : Guaranteed Access

Each and every data in a relational database is

guaranteed to be logically accessibility by using to a

combination of table name, primary key value and column

name.

RULE 3 : Systematic Treatment of Null Values

District Collectorate

Page 27: District Collector Ate

Abstract Null values are supported for representing missing

information and inapplicable information. They must be

handled in systematic way, independent of data types.

RULE 4 : Dynamic Online Catalog based Relation Model

The database description is represented at the logical

level in the same way as ordinary data so that authorized

users can apply the same relational language to its

interrogation as they do to the regular data.

RULE 5 : Comprehensive Data Sub Language

A relational system may support several languages and

various models of terminal use. However there must be one

language whose statement can express all of the following:

Data Definitions, View Definitions, Data Manipulations,

Integrity, Constraints, Authorization and transaction

boundaries.

RULE 6 : View Updating

Any view that is theoretical can be updatable if changes

can be made to the tables that effect the desired changes in

the view.

RULE 7 : High level Update, Insert and Delete

The capability of handling a base relational or derived

relational as a single operand applies not only retrieval of data

also to its insertion, updating, and deletion.

RULE 8 : Physical Data Independence

District Collectorate

Page 28: District Collector Ate

Abstract Application program and terminal activities remain

logically unimpaired whenever any changes are made in

either storage representation or access method.

RULE 9 : Logical Data Independence

Application programs and terminal activities remain

logically unimpaired whenever any changes are made in

either storage representation or access methods.

RULE 10 : Integrity Independence

Integrity constraints specific to particular database must

be definable in the relational data stored in the catalog, not in

application program.

RULE 11 : Distributed Independence

Whether or not a system supports database distribution,

it must have a data sub-language that can support distributed

databases without changing the application program.

RULE 12 : Non Sub-Version:

If a relational system has low level language, that low

language cannot use to subversion or by pass the integrity

rules and constraints expressed in the higher level relational

language.

Oracle supports the following Codd’s Rules

Rule 1: Information Rule (Representation of information)-YES.

Rule 2: Guaranteed Access-YES.

Rule 3: Systematic treatment of Null values-YES.

Rule 4: Dynamic on-line catalog-based Relational Model-YES.

Rule 5: Comprehensive data sub language-YES.

District Collectorate

Page 29: District Collector Ate

Abstract Rule 6: View Updating-PARTIAL.

Rule 7: High-level Update, Insert and Delete-YES.

Rule 8: Physical data Independence-PARTIAL.

Rule 9: Logical data Independence-PARTIAL.

Rule 10: Integrity Independence-PARTIAL.

Rule 11: Distributed Independence-YES.

Rule 12: Non-subversion-YES.

Java Server Pages Technology

Java Server Pages technology lets you put snippets of servlet code

directly into a text-based document. A JSP page is a text-based

document that contains two types of text: static template data,

which can be expressed in any text-based format such as HTML,

WML, and XML, and JSP elements, which determine how the page

constructs dynamic content.

Java Server Page™ (JSP): An extensible Web technology that uses

template data, custom elements, scripting languages, and server-

side Java objects to return dynamic content to a client. Typically the

template data is HTML or XML elements, and in many cases the

client is a Web browser.

According to JSP model1 we can develop the application as,

District Collectorate

Page 30: District Collector Ate

Abstract

According to above model the presentation logic has to be

implemented in JSP page and the business logic has to be

implemented as part of Java bean This model help us in separating

the presentation and business logic. For a large scale projects

instead of using model1 it is better to use model2 (MVC). Struts

frame work is based on model 2.

 

Java Server Pages (JSP) lets you separate the dynamic part of your

pages from the static HTML. You simply write the regular HTML in

the normal manner, using whatever Web-page-building tools you

normally use. You then enclose the code for the dynamic parts in

special tags, most of which start with "<%" and end with "%>". For

example, here is a section of a JSP page that results in something

like "Thanks for ordering Core WebProgramming

For URLof http://host/OrderConfirmation.jsp?

title=Core+Web+Programming:

Thanks for ordering

<I><%= request.getParameter("title") %></I>

You normally give your file a .jsp extension, and typically install it in

any place you could place a normal Web page. Although what you

write often looks more like a regular HTML file than a servlet, behind

the scenes, the JSP page just gets converted to a normal servlet,

with the static HTML simply being printed to the output stream

associated with the servlet's service method. This is normally done

the first time the page is requested, and developers can simply

request the page themselves when first installing it if they want to

be sure that the first real user doesn't get a momentary delay when

District Collectorate

Page 31: District Collector Ate

Abstract the JSP page is translated to a servlet and the servlet is compiled

and loaded. Note also that many Web servers let you define aliases

that so that a URL that appears to reference an HTML file really

points to a servlet or JSP page.

Aside from the regular HTML, there are three main types of JSP

constructs that you embed in a page: scripting elements, directives,

and actions. Scripting elements let you specify Java code that will

become part of the resultant servlet, directives let you control the

overall structure of the servlet, and actions let you specify existing

components that should be used, and otherwise control the

behavior of the JSP engine. To simplify the scripting elements, you

have access to a number of predefined variables such as request in

the snippet above.

2. Syntax Summary

JSP Element

Syntax Interpret

ation Notes

JSP Expression

<%= expression %>

Expression is evaluated and placed in output.

XML equivalent is<jsp:expression>expression</jsp:expression>. Predefined variables are request, response, out, session, application, config, and pageContext (available in scriptlets also).

JSP Scriptlet

<% code %>

Code is inserted in service method.

XML equivalent is<jsp:scriptlet>code</jsp:scriptlet>.

JSP Declaration

<%! code %>

Code is inserted in body of servlet class, outside of service method.

XML equivalent is<jsp:declaration>code</jsp:declaration>.

District Collectorate

Page 32: District Collector Ate

Abstract

JSP page Directive

<%@ page att="val" %>

Directions to the servlet engine about general setup.

XML equivalent is<jsp:directive.page att="val"\>. Legal attributes, with default values in bold, are:

import="package.class" contentType="MIME-Type" isThreadSafe="true|false" session="true|false" buffer="sizekb|none" autoflush="true|false" extends="package.class" info="message" errorPage="url" isErrorPage="true|false"

language="java"

JSP include Directive

<%@ include file="url" %>

A file on the local system to be included when the JSP page is translated into a servlet.

XML equivalent is<jsp:directive.include  file="url"\>.The URL must be a relative one. Use the jsp:include action to include a file at request time instead of translation time.

JSP Comment

<%-- comment --%>

Comment; ignored when JSP page is translated into servlet.

If you want a comment in the resultant HTML, use regular HTML comment syntax of <-- comment -->.

The jsp:include Action

<jsp:include page="relative URL" flush="true"/>

Includes a file at the time the page is requested.

If you want to include the file at the time the page is translated, use the page directive with the include attribute instead. Warning: on some servers, the included file must be an HTML file or JSP file, as determined by the server (usually based on the file extension).

The jsp:useBean Action

<jsp:useBean att=val*/> or<jsp:useBean att=val*>...

Find or build a Java Bean.

Possible attributes are: id="name" scope="page|request|

session|application"

District Collectorate

Page 33: District Collector Ate

Abstract

</jsp:useBean>

class="package.class" type="package.class"

beanName="package.class"

The jsp:setProperty Action

<jsp:setProperty att=val*/>

Set bean properties, either explicitly or by designating that value comes from a request parameter.

Legal attributes are name="beanName" property="propertyName|

*" param="parameterName"

value="val"

The jsp:getProperty Action

<jsp:getProperty name="propertyName" value="val"/>

Retrieve and output bean properties.

 

The jsp:forward Action

<jsp:forward page="relative URL"/>

Forwards request to another page.

 

The jsp:plugin Action

<jsp:plugin attribute="value"*> ...</jsp:plugin>

Generates OBJECT or EMBED tags, as appropriate to the browser type, asking that an applet be run using the Java Plugin.

 

jDriver for Oracle XA driver extends the WebLogic jDriver for Oracle for distributed

transactions.

District Collectorate

Page 34: District Collector Ate

Abstract

Type 2 (requires native libraries)

• WebLogic jDriver for Oracle

• WebLogic jDriver for OracleXA

• Third-party drivers, such as the Oracle OCI driver and the IBM DB2 driver

Between WebLogic Server and DBMS in local and distributed transactions.

Type 3

• WebLogic RMI Driver

Between an external client and WebLogic Server (connection pool).

Type 4 (pure Java)

• WebLogic jdrivers for Microsoft SQL Server

• Third-party drivers, including: Oracle Thin and Oracle Thin XA drivers Between

WebLogic Server and DBMS in local and distributed transactions.

An Overview of WebLogic Server 8.1

WebLogic Server provides essential features for developing and deploying mission-

critical e-commerce applications across distributed, heterogeneous computing

environments. These features include the following:

Standards leadership—Comprehensive enterprise Java support to ease the

implementation and deployment of application components. WebLogic Server is

the first independently developed Java application server to achieve J2EE

certification. In addition, BEA actively participates in the development of J2EE and

Web Services standards that drive innovation and advancement in Java and XML

technology.

Rich client options—WebLogic Server supports Web browsers and other

clients that use HTTP; Java clients that use RMI (Remote Method Invocation) or

IIOP (Internet Inter-ORB Protocol); SOAP clients on any SOAP-enabled platform;

and mobile devices that use (WAP) Wireless Access Protocol. Connectors from

BEA and other companies enable virtually any client or legacy application to work

with a WebLogic Server application.

District Collectorate

Page 35: District Collector Ate

Abstract Flexible Web services—WebLogic Server provides a solid platform for

deploying Web services as components of a heterogeneous distributed application.

Web services use a cross-platform, cross-language data model (XML) to provide

interoperability among application components on diverse hardware and software

platforms. Web services support user-defined data types and one-way asynchronous

operations. A Web service can intercept SOAP messages for further processing.

New Ant tasks automatically generate important components and package the

service into a deployable EAR file. WebLogic Server uses Web Services

Description Language (WSDL) 1.1, an XML-based specification, to describe Web

services. WebLogic Web services support Simple Object Access Protocol (SOAP)

1.1 and 1.2 as the message format and HTTP as a connection protocol.

Note: WebLogic Web services accept both SOAP 1.1 and 1.2 incoming requests,

but produce only SOAP 1.1 outgoing responses.

Enterprise e-business scalability—Efficient use and high availability of

critical resources are achieved through Enterprise Java Bean business components

and mechanisms such as WebLogic Server clustering for dynamic Web pages,

backend resource pooling, and connection sharing.

Robust administration—WebLogic Server offers a Web-based

Administration Console for configuring and monitoring WebLogic Server services.

A command-line interface for configuration makes it convenient to administer

WebLogic Servers with scripts.

E-commerce-ready security—WebLogic Server provides Secure Sockets

Layer (SSL) support for encrypting data transmitted across WebLogic Server,

clients, and other servers. User authentication and authorization for all WebLogic

Server services are provided through roles and security providers. External security

stores, such as Lightweight Directory Access Protocol (LDAP) servers, can still be

adapted to WebLogic realms, enabling single sign-on for the enterprise. The

Security Service Provider Interface makes it possible to extend WebLogic Security

services and to implement WebLogic Security features in applications.

Maximum development and deployment flexibility— WebLogic Server

provides tight integration with and support for leading databases, development

tools, and other environments.

Bi-directional functional interoperability between Java/J2EE objects and

Microsoft ActiveX components—BEA WebLogic jCOM provides a run-time

component that implements both Component Object Model (COM)/Distributed

Component Object Model (DCOM) and Remote Method Invocation (RMI)

District Collectorate

Page 36: District Collector Ate

Abstract distributed components infrastructures. This makes the objects look like native

objects for each environment.

Java Message Service (JMS)—An enterprise messaging system, also

referred to as message-oriented middleware (MOM), enables applications to

communicate with one another through the exchange of messages. A message is a

request, report, and/or event that contains information needed to coordinate

communication between different applications. A message provides a level of

abstraction, allowing you to separate the details about the destination system from

the application code.

The Java Message Service (JMS) is a standard API for accessing enterprise-

messaging systems. Specifically, JMS enables Java applications sharing a

messaging system to exchange messages, and it simplifies application

development by providing a standard interface for creating, sending, and

receiving messages.

Overview of Struts:In this chapter, you will cover:

• The struts configuration• Writing Actions• Working with Struts Custom tags• Setting up datasource• Handling exceptions• Displaying objects in a JSPJakarta Struts Live2In this chapter you will perform the following steps:1. Download Struts2. Setup a J2EE web application project that uses Struts3. Write your first Action4. Write your first “forward”5. Configure the Action and forward in the Struts configuration file6. Run and Test your first Struts application.7. Debugging Struts-Config.xml with the Struts Console8. Add Logging support with Log4J and commons logging.9. Write your first ActionForm10. Write your first input view (JSP page)11. Update the Action to handle the form, and cancel button12. Setup the database pooling with Struts13. Declaratively Handle Exception in the Struts Config file14. Display an Object with Struts Custom Tags

Download Struts 3

Download Struts

District Collectorate

Page 37: District Collector Ate

Abstract The first step in getting started with Struts is to download the Struts framework. The Struts home page is locatedat http://jakarta.apache.org/struts/index.html. You can find online documentation at the Struts home page. However,to download Struts you need to go to the Jakarta Download page at http://jakarta.apache.org/site/binindex.cgi. Since all of the Jakarta download links are on the same page, search for “Struts” on this page. Look forthe link that looks like this:Struts KEYS• 1.1 zip PGP MD5• 1.1 tar.gz PGP MD5Download either compressed file.One of the best forms of documentation on Struts is the source. Download the source from http://jakarta.apache.org/site/sourceindex.cgi. Once you have both the source and binaries downloaded, extract them.(WinZip works well for Windows users.) This tutorial will assume that you have extracted the files to c:\tools\jakarta-struts-1.1-src and c:\tools\ jakarta-struts-1.1. If you are using another drive, directory, or *n?x (UNIX orLinux), adjust accordingly.Jakarta Struts LiveSet up a J2EE Web Application Project That Uses Struts 4

Set up a J2EE Web Application Project That Uses StrutsStruts ships with a started web application archive file (WAR file) called struts-blank.war. The struts-blank.warfile has all of the configuration files, tag library descriptor files (tld files) and JAR files that you need to startusing Struts. The struts-blank.war file includes support for Tiles and the Validator framework. You can find thestruts-blank.war file under C:\tools\jakarta-struts-1.1\webapps.1. A war file is the same format as a ZIP file. Extract the struts-blank.war file to a directory calledc:\strutsTutorial (adjust if *n?x). When you are done, you should have a directory structure as follows:C:.|---META-INF|---pages|---WEB-INF|---classes| |--resources|---lib|---src|---java|---resourcesThe blank war file ships with an Ant build script under WEB-INF/src. The structure of the extracteddirectory mimics the structure of a deployed web application.

District Collectorate

Page 38: District Collector Ate

Abstract 2. In order for the build.xml file to work, you need to modify it to point to the jar file that contains theServlet API and the jar file that points to the JDBC API from your application server.For example, if you had Tomcat 5 installed under c:\tomcat5, then you would need to modify theservlet.jar property as follows:<property name="servlet.jar"value="C:/tomcat5/common/lib/servlet-api.jar"/>Tip: Tomcat is a Servlet container that supports JSP. If you are new to web development in Java, there areseveral very good books on Java web development. You will need to know about JSP, Servlets andweb applications to get the most out of this chapter and this book. If you are new to Java web development,try this tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/WebApp.html#wp76431.3. If you are using an IDE (Eclipse, NetBeans, JBuilder, WSAD, etc.), set up a new IDE project pointingto C:\strutsTutorial\WEB-INF\src\java as the source directory, add your application server’s servlet.jar file (servlet-api.jar for tomcat) and all the jar files from C:\strutsTutorial\WEB-INF\lib.Jakarta Struts LiveWrite Your First Action 5

Write Your First ActionActions respond to requests. When you write an Action, you subclass org.apache.struts.action.Actionand override the execute method.The execute method returns an ActionForward. You can think of an ActionForward as an output view.The execute method takes four arguments: an ActionMapping, ActionForm, HttpServletRequest and an HttpServletResponse(respectively).The ActionMapping is the object manifestation of the XML element used to configure an Action in the Strutsconfiguration file. The ActionMapping contains a group of ActionForwards associated with the current action.For now, ignore the ActionForm; we will cover it later. (It is assumed that you are familiar with HttpServletRequestand HttpServletResponse already.)Go to strutsTutorial\WEB-INF\src\java and add the package directory strutsTutorial. In the strutsTutorial directory,add the class UserRegistration as follows:package strutsTutorial;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;public class UserRegistrationAction extends Action {public ActionForward execute(ActionMapping mapping,

District Collectorate

Page 39: District Collector Ate

Abstract ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception {return mapping.findForward("success");}}Notice that this Action forwards to the output view called success. That output view, ActionForward, will be aplain old JSP. Let’s add that JSP.Jakarta Struts LiveWrite Your First “Forward” 6

Write Your First “Forward”Your first forward will be a JSP page that notifies the user that their registration was successful. Add a JSP pageto c:\strutsTutorial called regSuccess.jsp with the following content:<html><head><title>User Registration Was Successful!</title></head><body><h1>User Registration Was Successful!</h1></body></html>The forward is the output view. The Action will forward to this JSP by looking up a forward called success.Thus, we need to associate this output view JSP to a forward called success.Jakarta Struts LiveConfigure the Action and Forward in the Struts Configuration File 7

Configure the Action and Forward in the StrutsConfiguration FileNow that we have written our first Action and our first Forward, we need to wire them together. To wire themtogether we need to modify the Struts configuration file. The Struts configuration file location is specified by theconfig init parameter for the Struts ActionServlet located in the web.xml file. This was done for us already by theauthors of the blank.war starter application. Here is what that entry looks like:<servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param>...

District Collectorate

Page 40: District Collector Ate

Abstract <load-on-startup>2</load-on-startup></servlet>Thus, you can see that the blank.war’s web.xml uses WEB-INF/struts-config.xml file as the Struts configurationfile.Follow these steps to add the success forward:1. Open the c:\strutsTutorial\WEB-INF\struts-config.xml file.2. Look for an element called action-mappings.3. Add an action element under action-mappings as shown below.<action path="/userRegistration"type="strutsTutorial.UserRegistrationAction"><forward name="success" path="/regSuccess.jsp"/></action>The above associates the incoming path /userRegistration with the Action handler you wrote earlier, strutsTutorial.UserRegistrationAction.Jakarta Struts LiveConfigure the Action and Forward in the Struts Configuration File 8Whenever this web application gets a request with /userRegistration.do, the execute method of the strutsTutorial.UserRegistrationAction class will be invoked. The web.xml file maps request that end in *.do to the StrutsActionServlet. Since the web.xml file was provided for us, you will not need to edit it. Here is the mapping for inthe web.xml file for reference:<servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping>The Struts ActionServlet will invoke our action based on the path attribute of the above action mapping. TheActionServlet will handle all requests that end in *.do. You may recall that our Action looks up and returns a forwardcalled success. The forward element maps the success forward to the regSuccess.jsp file that you just createdin the last section.The ActionMapping that gets passed to the execute method of the Action handler is the object representation ofthe action mapping you just added in the Struts config file.Jakarta Struts LiveRun and Test Your First Struts Application 9

Run and Test Your First Struts ApplicationThe blank.war file ships with a started Ant script that will build and deploy the web application.If you are new to Ant, then today is a good day to get up to speed with it. Ant is a build system from Jakarta.Struts uses a lot of Jakarta projects. Most Jakarta projects use Ant. Ant is also a Jakarta project. (Technically, itused to be a Jakarta project, and it was promoted to a top level project at the 1.5 release.) You can learn more

District Collectorate

Page 41: District Collector Ate

Abstract about Ant and read documentation at http://ant.apache.org/. You can download Ant at http://www.apache.org/dist/ant/. Also, you can find an install guide for Ant at http://ant.apache.org/manual/installlist.html.Technically, you do not have to use Ant to continue on with this tutorial, but it will make things easier for you.It’s up to you. If you are not using Ant, now is a good time to start. Read http://ant.apache.org/manual/usinglist.html to start using Ant after you install it.If you are using the Ant build.xml file that ships with the blank.war (look under WEB-INF/src), you will need toadd the ${servlet.jar} file to the compile.classpath as follows:<path id="compile.classpath"><pathelement path ="lib/commons-beanutils.jar"/><pathelement path ="lib/commons-digester.jar"/><pathelement path ="lib/struts.jar"/><pathelement path ="classes"/><pathelement path ="${classpath}"/><pathelement path ="${servlet.jar}"/></path>Notice the addition of the <pathelement path ="${servlet.jar}"/>. The compile classpath is used by the compiletarget.After you add the pathelement, change the project.distname property to strutsTutorial as follows:<property name="project.distname" value="strutsTutorial"/>Go ahead and run the Ant build script as follows:C:\strutsTutorial\WEB-INF\src> antIf things go well, you should see the message BUILD SUCCESSFUL. Once you run the Ant build script with thedefault target, you should get a war file in your c:\projects\lib directory called strutsTutorial.war. Deploy this warfile to your application server under the web context strutsTutorial. You will need to refer to your applicationserver manual for more details on how to do this. For Tomcat and Resin, this is a simple matter of copying thewar file to Tomcat’s or Resin’s home-dir/webapps directory. The webapps directory is under the server directory.Jakarta Struts LiveRun and Test Your First Struts Application 10If you are not Ant savvy, you can simulate what this ant script does by setting your IDE to output the binary filesto C:\strutsTutorial\WEB-INF\classes, and then zipping up the c:\strutsTutorial directory into a file called strutsTutorial.war.Now that you have built and deployed your web application, test your new Action/forward combination by goingto http://localhost:8080/strutsTutorial/userRegistration.do. You should see the following:Figure 1.1 Running The Action for the first time

District Collectorate

Page 42: District Collector Ate

Abstract Congratulations! You have just written your first Struts Action. Now, admittedly this Action does not do much.At this point, you may be having troubles. The most obvious problem is probably a misconfigured struts-config.xml file. There are two ways to solve this.Jakarta Struts LiveRun and Test Your First Struts Application 11

Debug Struts-Config.xml with the Struts ConsoleIf you are new to XML, it may be a little hard to edit the struts-config.xml file. If you are having troubles withthe struts-config.xml file, you should download the Struts Console. The Struts Console is a Swing based strutsconfig.xml editor; it provides a GUI for editing struts-config files. The Struts Console works as a plugin forJBuilder, NetBeans, Eclipse, IntelliJ and more. The Struts Console can be found at http://www.jamesholmes.com/struts/console/; follow the install instructions at the site. If you have a problem, you can edit thestruts-config file with Struts Console. If there is a problem with the struts-config.xml file, the Struts Console willtake you to the line / column of text that is having the problem. For example, here is an example of editing astruts-config file with a malformed XML attribute:Figure 1.2 Running Struts Console against a malformed struts-config.xml file

Notice the Goto Error button. Clicking the button takes you to the exact line in the struts-config.xml file that ishaving the problem.Jakarta Struts LiveRun and Test Your First Struts Application 12Once everything is fixed, you can view and edit the struts-config.xml file with the Struts Console as follows:Figure 1.3 Running Struts Console in a happy world

The figure above shows editing struts-config.xml and inspecting the userRegistration action that you just configured.Personally, I only use the Struts Console if there is a problem or I want to validate my struts-config.xml file withoutlaunching the application server. I prefer editing the struts-config.xml with a text editor, but find that theStruts Console comes in handy when there is a problem. In addition to mentoring new Struts developers anddoing development myself, I teach a Struts course. I have found that Struts Console is extremely valuable to newStruts developers. Students (and new Struts developers) can easily make a small mistake that will cause the configfile to fail. I can stare for a long time at a struts-config.xml file, and not find a “one off” error. Most of theseerrors, you will not make once you are a seasoned Struts developer, but they can be very hard to diagnose withoutthe Struts Console when you are first getting started.Another debugging technique is to use common logging to debug the application at runtime.

District Collectorate

Page 43: District Collector Ate

Abstract Jakarta Struts LiveRun and Test Your First Struts Application 13

Add Logging Support with Log4J and Commons LoggingYou may wonder why we dedicate a whole section to logging. Well to put it simply, when you are new to Struts,you will need to do more debugging, and logging can facilitate your debugging sessions dramatically.The Struts framework uses Commons Logging throughout. Logging is a good way to learn what Struts does atruntime, and it helps you to debug problems. The Commons Logging framework works with many logging systems;mainly Java Logging that ships with JDK 1.4 and Log4J.Using Struts without logging can be like driving in the fog with your bright lights, especially when somethinggoes wrong. You will get a much better understanding how Struts works by examining the logs. Logging can beexpensive. Log4J allows you to easily turn off logging at runtime.Log4J is a full-featured logging system. It is easy to set up and use with Struts. You need to do several things:1. Download Log4J2. Unzip the Log4J distribution3. Copy the log4j.jar file to c:\strutsTutorial\WEB-INF\lib4. Create a log4j.properties file5. Start using logging in our own classesLike Struts, Log4J is an Apache Jakarta project. The Log4J home page is at http://jakarta.apache.org/log4j/docs/index.html. You can download Log4J from http://jakarta.apache.org/site/binindex.cgi. Search for Log4J on thispage. Look for the link that looks like:Log4j KEYS• 1.2.8 zip PGP MD5• 1.2.8 tar.gz PGP MD5Click on the 1.2.8 ZIP file link. Download this file to c:\tools, and adjust accordingly for different drives, directoriesand operating systems (like *n?x). Copy the log4j-1.2.8.jar file located in C:\tools\jakarta-log4j-1.2.8\dist\libto c:\strutsTutorial\WEB-INF\lib.Jakarta Struts LiveRun and Test Your First Struts Application 14Now that you have the jar file in the right location you need to add log4j.properties files so that the web applicationclassloader can find it. The Ant script copies all properties (*.properties) files from \WEB-INF\src\java to\WEB-INF\classes. The Ant script also deletes the \WEB-INF\classes directory. Thus, create a log4j.propertiesfile in the \WEB-INF\src\java directory with the following contents:log4j.rootLogger=WARN, stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayout

District Collectorate

Page 44: District Collector Ate

Abstract log4j.appender.stdout.layout.ConversionPattern=[%5p] %d{mm:ss}(%F:%M:%L)%n%m%n%nThe code above sends output to the stdout of the application with the priority, date time stamp, file name, methodname, line number and the log message. Logging is turned on for classes under the Struts package and the strutsTutorialcode.To learn more about Log4J, read the online documentation at http://jakarta.apache.org/log4j/docs/manual.html,and then read the JavaDoc at http://jakarta.apache.org/log4j/docs/api/index.html. Look up the classorg.apache.log4j.PatternLayout in the JavaDocs at the top of the file is a list of conversion characters for the outputlog pattern. You can use the conversion characters to customize what gets output to the log.Putting log4j on the classpath (copying the jar file to WEB-INF\lib), causes the Commons Logging to use it. Thelog4J framework finds the log4j.properties file and uses it to create the output logger.If you start having problems with Struts, then set up the logging level of Struts to debug by adding the followingline to log4j.properties file:log4j.logger.org.apache.struts=DEBUGUnderneath the covers, we are using Log4J. However, if we want to use logging in our own code, we should useCommons Logging, which allows us to switch to other logging systems if necessary. Thus, we will use the CommonsLogging API in our own code. To learn more about Commons Logging, read the “short online manual” athttp://jakarta.apache.org/commons/logging/userguide.html.Jakarta Struts LiveRun and Test Your First Struts Application 15Edit the UserRegistrationAction by importing the two Commons Logging classes and putting a trace call in theexecute method as follows:import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;…private static Log log = LogFactory.getLog(UserRegistrationAction.class);public ActionForward execute(...) throws Exception {log.trace("In execute method of UserRegistrationAction");return mapping.findForward("success");}You will need to add the Commons Logging Jar file to the compile.classpath in \WEB-INF\src\java\build.xmlfile as follows:<path id="compile.classpath"><pathelement path ="lib/commons-beanutils.jar"/><pathelement path ="lib/commons-digester.jar"/><pathelement path ="lib/struts.jar"/><pathelement path ="classes"/><pathelement path ="${classpath}"/>

District Collectorate

Page 45: District Collector Ate

Abstract <pathelement path ="${servlet.jar}"/><pathelement path ="lib/commons-logging.jar"/></path>Then to get the above trace statement to print out to the log you need to add this line to the log4j.properties file:log4j.logger.strutsTutorial=DEBUGRebuild and deploy the war file, re-enter the url to exercise the action class and look for the log line in the appserver’s console output.Jakarta Struts LiveRun and Test Your First Struts Application 16There are six levels of logging as follows listed in order of importance: fatal, error, warn, info, debug andtrace. The log object has the following methods that you can use to log messages.log.fatal(Object message);log.fatal(Object message, Throwable t);log.error(Object message);log.error(Object message, Throwable t);log.warn(Object message);log.warn(Object message, Throwable t);log.info(Object message);log.info(Object message, Throwable t);log.debug(Object message);log.debug(Object message, Throwable t);log.trace(Object message);log.trace(Object message, Throwable t);Logging is nearly essential for debugging Struts applications. You must use logging; otherwise, your debuggingsessions may be like flying blind.Jakarta Struts LiveWrite Your First ActionForm 17

Write Your First ActionFormActionForms represent request data coming from the browser. ActionForms are used to populate HTML forms todisplay to end users and to collect data from HTML forms. In order to create an ActionForm, you need to followthese steps:1. Create a new class in the strutsTutorial package called UserRegistrationForm that subclassesorg.apache.struts.action.ActionForm as follows:import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionMapping;import org.apache.struts.action.ActionErrors;import org.apache.struts.action.ActionError;import javax.servlet.http.HttpServletRequest;public class UserRegistrationForm extends ActionForm {2. Now you need to create JavaBean properties for all the fields that you want to collect from the HTMLform. Let’s create firstName, lastName, userName, password, passwordCheck (make sure theyentered the right password), e-mail, phone, fax and registered (whether or not they are already registered)

District Collectorate

Page 46: District Collector Ate

Abstract properties. Add the following fields:private String firstName;private String lastName;private String userName;private String password;private String passwordCheck;private String email;private String phone;private String fax;private boolean registered;Add getter and setter methods for each field as follows:public String getEmail() {return email;}public void setEmail(String string) {email = string;}Jakarta Struts LiveWrite Your First ActionForm 183. Now you have defined all of the properties for the form. (Reminder: each getter and setter pair definesa property.) Next, you need to override the reset method. The reset method gets called each time arequest is made. The reset method allows you to reset the fields to their default value. Here is anexample of overwriting the reset method of the ActionForm:public void reset(ActionMapping mapping,HttpServletRequest request) {firstName=null;lastName=null;userName=null;password=null;passwordCheck=null;email=null;phone=null;fax=null;registered=false;}If you like, please print out a trace method to this method using the logging API, e.g.,log.trace("reset").4. Next you need validate the user entered valid values. In order to do this, you need to override thevalidate method as follows:public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) {ActionErrors errors = new ActionErrors();if (firstName==null|| firstName.trim().equals("")){errors.add("firstName",new ActionError("userRegistration.firstName.problem"));}

District Collectorate

Page 47: District Collector Ate

Abstract ...return errors;}The validate method returns a list of errors (ActionErrors). The ActionErrors display on the inputHTML form. You use your Java programming skills to validate if their typing skills are up to task.The above code checks to see that firstName is present; if it is not present (i.e., it is null or blank),then you add an ActionError to the ActionErrors collection. Notice that when you construct anActionError object, you must pass it a key into the resource bundle (“userRegistration.firstName”).Thus, we need to add a value to this key in the Resource bundle.Jakarta Struts LiveWrite Your First ActionForm 19Please open the file C:\strutsTutorial\WEB-INF\src\java\resources\application.properties. Add a keyvalue pair as follows:userRegistration.firstName.problem=The first name was blankIf the firstName is blank, the control gets redirected back to the input form, and the above messagedisplays. Using a similar technique, validate all the fields.Jakarta Struts LiveWrite Your First Input View (JSP Page) 20

Write Your First Input View (JSP Page)Next, we want to create an HTML form in JSP that will act as the input to our Action. The input is like the inputview, while the forwards are like output views. In order to create the input view, you will do the following:1. Create a JSP page called userRegistration.jsp in the c:\strutsTutorial directory.2. Import both the Struts HTML and Struts Bean tag libraries. The tag libraries have already beenimported into the web.xml file as follows:<taglib><taglib-uri>/tags/struts-bean</taglib-uri><taglib-location>/WEB-INF/struts-bean.tld</taglib-location></taglib><taglib><taglib-uri>/tags/struts-html</taglib-uri><taglib-location>/WEB-INF/struts-html.tld</taglib-location></taglib>One of the advantages of using the blank.war file is that all the things you need are already configured.You just add the parts that are needed for your application. To import the two tag libraries, youwould use the taglib directive as follows:<%@ taglib uri="/tags/struts-html" prefix="html"%><%@ taglib uri="/tags/struts-bean" prefix="bean"%>

District Collectorate

Page 48: District Collector Ate

Abstract 3. Use the html:form tag to associate the form with the Action. The html:form tag associates theform to an action mapping. You use the action attribute to specify the path of the action mapping asfollows:<html:form action="userRegistration">4. Output the errors associated with this form with the html:errors tag. ActionForms have a validatemethod that can return ActionErrors. Add this to the JSP:<html:errors/>Note there are better ways to do this. Struts 1.1 added html:messages, which is nicer as it allowsyou to get the markup language out of the resource bundle. This is covered in more detail later.Jakarta Struts LiveWrite Your First Input View (JSP Page) 215. Update the Action to associate the Action with the ActionForm and input JSP. In order to do this, youneed to edit the struts-config.xml file. If you do not feel comfortable editing an XML file, then use theStruts Console. Add the following form-bean element under the form-beans element as follows:<form-bean name="userRegistrationForm"type="strutsTutorial.UserRegistrationForm" />The code above binds the name userRegistration to the form you created earlier: strutsTutorial.UserRegistrationForm.Now that you have added the form-bean element, you need to associate the userRegistrationaction mapping with this form as follows:<action path="/userRegistration"type="strutsTutorial.UserRegistrationAction"name="userRegistrationForm"input="/userRegistration.jsp"><forward name="success" path="/regSuccess.jsp" /></action>Notice the addition of the name and input attributes. The name attribute associates this action mappingwith the userRegistrationForm ActionForm that you defined earlier. The input attribute associatesthis action mapping with the input JSP. If there are any validation errors, the execute method ofthe action will not get called; instead the control will go back to the userRegistration.jsp file until theform has no ActionErrors associated with it.6. Create the labels for the Form fields in the resource bundle. Each field needs to have a label associatedwith it. Add the following to the resource bundle (c:/strutsTutorial/WEB-INF/src/java/resources/application.properties):userRegistration.firstName=First Name

District Collectorate

Page 49: District Collector Ate

Abstract userRegistration.lastName=Last NameuserRegistration.userName=User NameuserRegistration.password=PassworduserRegistration.email=EmailuserRegistration.phone=PhoneuserRegistration.fax=FaxYou could instead hard code the values in the JSP page. Putting the value in the resource bundleallows you to internationalize your application.Jakarta Struts LiveWrite Your First Input View (JSP Page) 227. Use the bean:message to output the labels. When you want to output labels in the JSP from theresource bundle, you can use the bean:message tag. The bean:message tag looks up the value inthe resource bundle and outputs it from the JSP. The following outputs the label for the firstNamefrom the resource bundle:<bean:message key="userRegistration.firstName" />8. Use the html:text tag to associate the ActionForm’s properties to the HTML form’s fields. Thehtml:text associates an HTML text field with an ActionForm property as follows:<html:text property="firstName" />The above associates the HTML text field with the firstName property from your ActionForm. Thehtml:form tag is associated with the ActionForm via the action mapping. The individual text fieldsare associated with the ActionForm’s properties using the html:text tag.9. Create an html:submit tag and an html:cancel tag to render a submit button and a cancel buttonin html as follows:<html:submit />...<html:cancel />At this point you should be able to deploy and test your Struts application. The Action has not beenwired to do much of anything yet. But the form will submit to the Action. And, if a form field isinvalid the control will be forwarded back to the input form. Try this out by leaving the firstNamefield blank.Jakarta Struts LiveWrite Your First Input View (JSP Page) 23If you are having problems, you may want to compare what you have written to the solution. Here is what theuserRegistration.jsp looks like after you finish (your HTML may look different):<%@ taglib uri="/tags/struts-html" prefix="html"%><%@ taglib uri="/tags/struts-bean" prefix="bean"%><html><head><title>User Registration</title>

District Collectorate

Page 50: District Collector Ate

Abstract </head><body><h1>User Registration</h1><html:errors/><table><html:form action="userRegistration"><tr><td><bean:message key="userRegistration.firstName" />*</td><td><html:text property="firstName" /></td></tr><td><bean:message key="userRegistration.lastName" />*</td><td><html:text property="lastName" /></td><tr><td><bean:message key="userRegistration.userName" />*</td><td><html:text property="userName" /></td></tr><tr><td><bean:message key="userRegistration.email" />*</td><td><html:text property="email" /></td></tr><tr>Jakarta Struts LiveWrite Your First Input View (JSP Page) 24<td><bean:message key="userRegistration.phone" /></td><td><html:text property="phone" /></td></tr><tr><td><bean:message key="userRegistration.fax" /></td><td><html:text property="fax" /></td></tr>

District Collectorate

Page 51: District Collector Ate

Abstract <tr><td><bean:message key="userRegistration.password" />*</td><td><html:password property="password" /></td></tr><tr><td><bean:message key="userRegistration.password" />*</td><td><html:password property="passwordCheck" /></td></tr><tr><td><html:submit /></td><td><html:cancel /></td></tr></html:form></table></body></html>Jakarta Struts LiveWrite Your First Input View (JSP Page) 25The form should look like this when it first gets loaded. (You load the form by going to http://localhost:8080/strutsTutorial/userRegistration.jsp.)Figure 1.4 User Registration JSPJakarta Struts LiveWrite Your First Input View (JSP Page) 26If you leave the firstName blank, then you should get a form that looks like this.Figure 1.5 User Registration JSP with validation errors

Notice that the error message associated with the firstName displays, since the firstName was left blank. It isinstructive to view the logs as you run the example to see the underlying interactions of the Struts framework.Once you complete the form and hit the Submit button, the execute method of gets UserRegistrationActioninvoked. Currently the execute method just forwards to regSuccess.jsp, which is mapped into the successforward, whether or not the Cancel button is pressed.Jakarta Struts LiveUpdate the Action to Handle the Form and Cancel Buttons 27

Update the Action to Handle the Form and Cancel Buttons

District Collectorate

Page 52: District Collector Ate

Abstract Let’s do something with the ActionForm that gets passed to the Action. Once you fill in the form correctly (novalidation errors) and hit the submit button, the execute method of the UserRegistrationAction is invoked.Actually, the execute method gets invoked whether or not you hit the submit button or the cancel button.You need check to see if the cancel button was clicked; it was clicked forward to welcome. The welcome forwardwas setup by the authors of blank.war, and it forwards to “/Welcome.do”, which forwards to /pages/Welcome.jsp. Check out the struts-config.xml file to figure out how they did this. To check and see if the cancelbutton was clicked, you need to use the isCanceled method of the Action class in the execute method as follows:public ActionForward execute(...)...{...if (isCancelled(request)){log.debug("Cancel Button was pushed!");return mapping.findForward("welcome");}...}The isCancelled method takes an HttpServletRequest as an argument. The execute method was passed anHttpServerletRequest.Next, you need to cast the ActionForm to an UserRegistrationForm . In order to use the form that was submittedto the action, you need to cast the ActionForm to the proper type. Thus, you will need to cast the Action-Form that was passed to the execute method to a UserRegistrationForm as follows:UserRegistrationForm userForm =(UserRegistrationForm) form;Now you can start using the UserRegistrationForm like this:log.debug("userForm firstName" + userForm.getFirstName());For now, just print out the firstName with the logging utility. In the next section, you’ll do something more usefulwith this form—you will write it to a database.

Exception Handling with StrutsBad things happen to good programs. It is our job as fearless Struts programmers to prevent these bad thingsfrom showing up to the end user. You probably do not want the end user of your system to see a Stack Trace. Anend user seeing a Stack Trace is like any computer user seeing the “Blue Screen of Death” (generally not a verypleasant experience for anyone).It just so happens that when you enter an e-mail address into two User Registrations, you get a nasty error messageas the e-mail address is the primary key of the database table. Now, one could argue that this is not a true

District Collectorate

Page 53: District Collector Ate

Abstract “exceptional” condition, as it can happen during the normal use of the application, but this is not a tutorial ondesign issues. This is a tutorial on Struts, and this situation gives us an excellent opportunity to explain Strutsdeclarative exception handling.If you enter in the same e-mail address twice into two User Registrations, the system will throw ajava.sql.SQLException. In Struts, you can set up an exception handler to handle an exception.An exception handler allows you to declaratively handle an exception in the struts-config.xml file by associatingan exception to a user friendly message and a user friendly JSP page that will display if the exception occurs.Let’s set up an exception handler for this situation. Follow these steps:1. Create a JSP file called userRegistrationException.jsp in the root directory of the project (c:\strutsTutorial).<%@ taglib uri="/tags/struts-html" prefix="html"%><html><head><title>User Registration Had Some Problems</title></head><body><h1>User Registration Had Some Problems!</h1><html:errors/></body></html>Notice the use of html:errors to display the error message associated with the exception.Jakarta Struts LiveException Handling with Struts 332. Add an entry in the resource bundle under the key userRegistration.sql.exception thatexplains the nature of the problem in terms that the end user understands. This message will be usedby the exception handler. Specifically, you can display this message using the html:errors tag in theuserRegistrationException.jsp file. Edit the properties file associated with the resource bundle(located at C:\strutsTutorial\WEB-INF\src\java\resources\application.properties if you have been followingalong with the home game version of the Struts tutorial).userRegistration.sql.exception=There was a problem adding the User. \n Themost likely problem is the user already exists or the email\n address isbeing used by another user.(The code above is all one line.)3. Add an exception handler in the action mapping for /userRegistration that handlesjava.sql.SQLException as follows:

District Collectorate

Page 54: District Collector Ate

Abstract <action path="/userRegistration"type="strutsTutorial.UserRegistrationAction"name="userRegistrationForm"input="/userRegistration.jsp"><exception type="java.sql.SQLException"key="userRegistration.sql.exception"path="/userRegistrationException.jsp" /><forward name="success" path="/regSuccess.jsp" /><forward name="failure" path="/regFailure.jsp" /></action>Notice that you add the exception handler by using the exception element (highlighted above). Theabove exception element has three attributes: type, key and path. The type attribute associates thisexception handler with the exception java.sql.SQLException. The key attribute associates theexception handler with a user friendly message out of the resource bundle. The path attribute associatesthe exception handler with the page that will display if the exception occurs.Jakarta Struts LiveException Handling with Struts 34If you do everything right, you get the following when the exception occurs.Figure 1.6 Declaritive Exception HandlingJakarta Struts LiveDisplay an Object with Struts Tags 35

Display an Object with Struts TagsStruts supports a Model 2 architecture. The Actions interact with the model and perform control flow operations,like which view is the next view to display. Then, Actions delegate to JSP (or other technologies) to displayobjects from the model.To start using Struts with this tutorial, follow these steps:1. Add an attribute called attribute to the mapping that causes the ActionForm to be mapped intoscope as follows:<action path="/userRegistration"type="strutsTutorial.UserRegistrationAction"name="userRegistrationForm"attribute="user"input="/userRegistration.jsp">...Notice the above action mapping uses the attribute called attribute. The attribute maps the Action-Form into a scope (session scope by default) under “user”. Now that the ActionForm is in sessionscope, you can display properties from the ActionForm in the view.2. Edit the regSuccess.jsp that you created earlier. The regSuccess.jsp is an ActionForward for the User-RegistrationAction. The regSuccess.jsp is the output view for the Action. In order to display theActionForm, you could use the Struts bean tag library.

District Collectorate

Page 55: District Collector Ate

Abstract 3. Import the bean tag library into the JSP as follows:<%@ taglib uri="/tags/struts-bean" prefix="bean"%>4. Use the bean:write to output properties of the ActionForm<bean:write name="user" property="firstName" />The code above prints out the firstName property of the user object. Use the above technique toprint out all of the properties of the user object.When you are done with the JSP, it should look something like this:<%@ taglib uri="/tags/struts-bean" prefix="bean"%><html><head><title>User Registration Was Successful!Jakarta Struts LiveDisplay an Object with Struts Tags 36</title></head><body><h1>User Registration Was Successful!</h1></body><table><tr><td><bean:message key="userRegistration.firstName" /></td><td><bean:write name="user" property="firstName" /></td></tr><tr><td><bean:message key="userRegistration.lastName" /></td><td><bean:write name="user" property="lastName" /></td></tr><tr><td><bean:message key="userRegistration.email" /></td><td><bean:write name="user" property="email" /></td></tr></table></html>Jakarta Struts LiveUsing Logic Tags to Iterate over Users 37

Using Logic Tags to Iterate over UsersStruts provides logic tags that enable you to have display logic in your view without putting Java code in yourJSP with Java scriptlets. To start using the Logic tags, follow these steps.

District Collectorate

Page 56: District Collector Ate

Abstract 1. Create a JavaBean class called User to hold a user with email, firstName and lastName properties.Here is a possible implementation (partial listing):package strutsTutorial;import java.io.Serializable;public class User implements Serializable {private String lastName;private String firstName;private String email;public String getEmail() {return email;}...public void setEmail(String string) {email = string;}...}2. Create a new Action called DisplayAllUsersAction.public class DisplayAllUsersAction extends Action {In the new Action’s execute method, complete the following steps:3. Get the userDB datasource.DataSource dataSource = getDataSource(request, "userDB");4. Create a DB connection using the datasource.Connection conn = dataSource.getConnection();Statement statement = conn.createStatement();Jakarta Struts LiveUsing Logic Tags to Iterate over Users 385. Query the DB, and copy the results into a collection of the User JavaBean:ResultSet rs =statement.executeQuery("select FIRST_NAME, LAST_NAME, EMAIL from USER");List list = new ArrayList(50);while (rs.next()){String firstName = rs.getString(1);String lastName = rs.getString(2);String email = rs.getString(3);User user = new User();user.setEmail(email);user.setFirstName(firstName);user.setLastName(lastName);list.add(user);}if (list.size() > 0){request.setAttribute("users", list);}Tip: Don’t forget to close the connection using a try/finally block.Warning! You do not typically put SQL statements and JDBC code directly in an Action. This type of codeshould be in a DataAccessObject. A DataAccessObject would encapsulate the CRUD access for aparticular domain object. The DataAccessObject is part of the Model of the application.6. Create a new JSP called userRegistrationList.jsp.In the new JSP, perform the following steps:

District Collectorate

Page 57: District Collector Ate

Abstract 7. Import the logic tag library into the userRegistrationList.jsp.<%@ taglib uri="/tags/struts-logic" prefix="logic"%>8. Check to see if the users are in scope with the logic:present tag.<logic:present name="users">... (Step 9 goes here)</logic:present>9. If the users are in scope, iterate through them.<logic:iterate id="user" name="users">... (Step 10 goes here)</logic:iterate>Jakarta Struts LiveUsing Logic Tags to Iterate over Users 3910. For each iteration, print out the firstName, lastName and email using bean:write<bean:write name="user"property="firstName"/><bean:write name="user"property="lastName"/><bean:write name="user"property="email"/>One possible implementation for the JSP is as follows:<%@ taglib uri="/tags/struts-bean" prefix="bean"%><%@ taglib uri="/tags/struts-logic" prefix="logic"%><html><head><title>User Registration List</title></head><body><h1>User Registration List</h1><logic:present name="users"><table border="1"><tr><th><bean:messagekey="userRegistration.firstName"/></th><th><bean:messagekey="userRegistration.lastName" /></th><th><bean:messagekey="userRegistration.email" /></th></tr><logic:iterate id="user" name="users"><tr><td><bean:write name="user"Jakarta Struts LiveUsing Logic Tags to Iterate over Users 40property="firstName"/></td><td><bean:write name="user"

District Collectorate

Page 58: District Collector Ate

Abstract property="lastName"/></td><td><bean:write name="user"property="email"/></td></tr></logic:iterate></table></logic:present></body></html>Jakarta Struts LiveUsing Logic Tags to Iterate over Users 41Figure 1.7 User Listing

11. Create a new entry in the struts-config.xml file for this new Action.<action path="/displayAllUsers"type="strutsTutorial.DisplayAllUsersAction"><forward name="success"path="/userRegistrationList.jsp"/></action>Now you can deploy and test this new Action by going to: http://localhost:8080/strutstutorial/displayAllUsers.do

Working with ActionForms and DynaActionFormsActionForms function as data transfer objects to and from HTML forms.ActionForms populate HTML forms todisplay data to the user and also act like an object representation of request parameters, where the requestparameters attributes are mapped to the strongly typed properties of the ActionForm. ActionForms also performfield validation.This chapter is divided into two sections. The first section covers the theory and concepts behind ActionForms.The second part covers common tasks that you will need to perform with ActionForms like:• Creating a master detail ActionForm (e.g., Order has LineItems)• Creating an ActionForm with nested JavaBean properties• Creating an ActionForm with nested indexed JavaBean properties• Creating an ActionForm with mapped backed properties• Loading form data in an ActionForm to display• Configuring DynaActionFormsJakarta Struts LiveDefining an ActionForm 75

Defining an ActionFormAn ActionForm is an object representation of an HTML form (or possibly several forms in a wizard-style interface).ActionForms are a bit of an anomaly in the MVC realm. An ActionForm is not part of the Model. An

District Collectorate

Page 59: District Collector Ate

Abstract ActionForm sits between the View and Controller acting as a transfer object between the two layers. An Action-Form represents not the just the data, but the data entry form itself.ActionForms have JavaBean properties to hold fields from the form. An ActionForm’s JavaBean properties canbe primitive types, indexed properties, Maps (i.e., HashMap), or other JavaBeans (nested beans). Thus, Action-Forms do not have to be one-dimensional; they can consist of master detail relationships and/or can havedynamic properties. (Examples of indexed properties, dynamic properties, and master detail relationships can befound in the tutorial section of this chapter.)ActionForms are configured to be stored by Struts in either session or request scopes. Session scope is the defaultscope. Struts automatically populate the ActionForm's JavaBean properties from corresponding request parameters,performing type conversion into primitive types (or primitive wrapper types) if needed. You typically useSession scope for wizard-style interfaces and shopping carts.With ActionForms, you use JavaBean properties to represent the fields in the HTML form. You can also use JavaBeanproperties to represent buttons and controls; this helps when deciding which button or control the userselected.Understanding the Life Cycle of an ActionFormThe ActionServlet handles requests for Struts (i.e., requests ending in *.do are common). The ActionServletlooks up the RequestProcessor associated with the module prefix. The RequestProcessor implements the handlingof the life cycle and uses RequestUtils as a façade to Struts objects mapped into Servlet scopes (request,session, and application).When a form gets submitted, Struts looks up the action mapping for the current request path from the Module-Config. The ModuleConfig is the object manifestation of the struts-config.xml file, each module gets its ownModuleConfig. (Recall that the action attribute in the html:form tag specifies the path of the action to invoke.)Struts locates the form-bean mapping from the action mapping associated with the request path. (This occurs inthe processActionForm method of the RequestProcessor by calling the createActionForm method ofRequestUtils.)If Struts does not find an ActionForm in the scope specified by the action mapping, it will create an instance ofthe ActionForm identified form-bean mapping.Struts populates the ActionForm by mapping the request parameters from the HTML form variables to the Java-Bean properties of the ActionForm instance. Before it populates the form, Struts calls the reset() method of the

District Collectorate

Page 60: District Collector Ate

Abstract ActionForm. (This occurs in the processPopulate method of the RequestProcessor by calling the populatemethod of RequestUtils.)Jakarta Struts LiveDefining an ActionForm 76If validation is required and is successful, an instance of the Action class will be invoked. Validation is requiredif the validate attribute of the action mapping is not false (the default is true). If validation fails, control will bereturned to the submitting form (the input JSP) where the JSP form fields will be populated by the ActionForm.The ActionForm is valid if the validate() method returns null or an empty ActionErrors collection. (This occursin the processValidate method of the RequestProcessor.)The life cycle of an ActionForm is demonstrated in the following diagram.Figure 3.1 Life Cycle of an ActionFormJakarta Struts LiveDefining an ActionForm 77Understanding ActionForm’s reset() MethodThe reset() method allows you to set properties to default values. The ActionForm is a transfer object; therefore,you should not deal with the Model from the reset() method, and don’t initialize properties for an update operationin the reset() method.The reset() method was mainly added so you could reset check boxes to false. Then, the selected check boxeswill be populated when Struts populates the form. The HTTP protocol sends only selected check boxes. It doesnot send unselected check boxes. (Examples of working with check boxes in the reset() method are in the tutorialsection of this chapter.)Understanding ActionForm’s validate() MethodThe purpose of the validate() method is to check for field validation and relationships between fields. Do not performbusiness logic checks in the validate() method; it is the job of the action to work with the Model to performbusiness logic checks.A field validation would check to see if a field is in a certain range, if a field was present, a certain length, andmore. A relationship validation would check the relationship between the fields. Checking to see if the start dateis before the end date is a good example of a relationship validation. Another relationship validation is checkingto see if the password and the check password field are equal. (Examples of performing validation can be foundin the tutorial section of this chapter.)Jakarta Struts LiveDefining an ActionForm 78

The Do’s and Don’ts of Automatic Type ConversionActionForms can be strongly typed. Struts will convert Strings and String Arrays into primitive and primitive

District Collectorate

Page 61: District Collector Ate

Abstract arrays.Struts converts the request parameters into a HashMap and then uses common BeanUtils to populate the Action-Form with the request parameters. (This occurs in the processPopulate method of the RequestProcessor bycalling the populate method of RequestUtils.) The interesting thing about this is that BeanUtils will performtype conversion from the strings coming from the request parameter to any primitive or primitive wrapperclass.At first, this seems like a boon. Problems arise when you implement validation. Let’s say a user mistypes an integerfield with the letters “abc”. BeanUtils will convert “abc” to 0 if it corresponds to an int property of theActionForm. This is bad news. Even if you did bounds checking in the validate() method of the ActionForm andthe 0 field was not allowed, when control forwarded back to the input JSP the user will not see the “abc” theytyped in; they will see 0. Even worse is if 0 is a valid value for your application, then there is no way to check tosee if the user entered in the right number for the field.Thus, you have to follow this rule when using the automatic type conversion: if the user types in the value, thenmake the ActionForm property representing the field a string. Usually this means if the field is rendered withhtml:text, html:textarea, or html:password, then make the field a string. This does not apply to drop-down boxes(html:select), check boxes (html:checkbox), and the like.Tip: If the user types in the value, then make the property a string.Jakarta Struts LiveWhat an ActionForm Is 79

What an ActionForm IsData Supplier: Supplies Data to html:formAn ActionForm supplies data to be displayed by JSP pages. In the CRUD realm, the ActionForm would be usedto transfer data to the html:form tag of an update.jsp page. In fact, the html:form tag will not work unless theActionForm is present and in the correct scope. In this role, the ActionForm supplies data to the html:form.Data Collector: Processes Data from html:formAn ActionForm receives form data (request parameters) from browsers usually with forms that were renderedwith html:form. Struts converts that data into an ActionForm. Thus, instead of handling request parametersdirectly, you would work with the ActionForm (possibly strongly typed).Action Firewall: Validates Data before the Action Sees ItAn ActionForm acts like a traffic cop. If validation is turned on for an action, the action will never be executed

District Collectorate

Page 62: District Collector Ate

Abstract unless the ActionForm’s validate() method says the ActionForm is valid. The action in turn deals with theModel; the Model is never passed bad data from the view. This is a boon from an architecture standpoint. YourModel just needs to worry about business rule violations not fumbling finger violations. This turns out to be agood separation of concern that makes the Model easier to test and validate.Jakarta Struts LiveWhat an ActionForm is Not 80

What an ActionForm is NotActionForms can be abused and used in manners that were not intended by the Struts framework. There are somethings to keep in mind when using ActionForms.Not Part of the Model or Data Transfer ObjectActionForms are not part of the Model and should not be used as data transfer objects between the controller(Actions) and the Model. The first reason is that the Model should be “Struts agnostic.” The second reason is thatActionForms are not strongly typed as they are used to perform field validations and reflect bad fields back to theuser to see and fix. Often times there are one-to-one relationships between ActionForms and the Model DTOs(data transfer objects). In that case, you could use BeanUtils.copyProperties to move and convert data from theActionForm to the Model DTOwhere appropriate.Not an Action, Nor Should It Interact with the ModelThe ActionForm should not deal with the Model in the reset() method or the validate() method. This is the job ofthe Action. ActionForms have a limited set of responsibilities: act as a transfer object, reset the fields to defaultvalues, and validate the fields. If you are doing more than that in your ActionForm, then you are breaking howStruts delimits the areas of concern. (I am okay with breaking the rules, as long as you know what the rules areand have a good reason for breaking them.)Jakarta Struts LiveReducing the Number of ActionForms 81

Reducing the Number of ActionFormsA common concern with Struts is the number of ActionForms that need to be created. Essentially, you have tocreate an ActionForm for each HTML form. There are many strategies to get around this.Super ActionFormsOne common strategy to get around the number of ActionForms is to use a super class ActionForm that hasmany of the fields that each of the other HTML forms need. This works out well if a lot of forms are similar,which can be the case with some web applications.Advantage

District Collectorate

Page 63: District Collector Ate

Abstract The advantage to this approach is that you reduce the number of fields you need to add to each ActionForm byhaving a super class ActionForm that contains a lot of the common fields.DeltaOne of the disadvantages to this approach is you end up carrying around a lot of fields that some Actions don’tcare about. Essentially, you have opted to trade the cohesiveness of an ActionForm to reduce the number ofclasses in your system.DynaActionFormsIn teaching, consulting Struts, and developing with Struts, I have found that DynaActionForms are either readilyembraced or consistently avoided. The idea behind DynaActionForms is that instead of creating an ActionFormfor each HTML form, you instead configure an ActionForm for each HTML form.AdvantageSome folks feel creating an ActionForm class for each HTML form in your Struts application is time-consuming,maintenance-intensive, and plain frustrating. With DynaActionForm classes, you don’t have to create an Action-Form subclass for each form and a bean property for each field. Instead, you configure a DynaActionForm’sproperties, type, and defaults in the Struts configuration file.DeltaYou still have to create the DynaActionForm in the Struts configuration file. When you use the DynaAction-Form, you have to cast all the properties to their known type. Using a DynaActionForm is a lot like using a Hash-Map. In your Action, if you are accessing a DynaActionForm and misspell a property name, the compiler willnot pick it up; instead, you will get a runtime exception. If you cast an integer to a float by mistake, the compilerwill not pick it up; you will get a runtime exception. DynaActionForms are not type safe. If you use an IDE, codecompletion does not work with DynaActionForms. If you override the reset() method or validate() method, youdefeat the purpose of having a DynaActionForm. Finally, DynaActionForms are not really dynamic, as you stillhave to change the configuration file and then restart the web application to get Struts to recognize an additionalfield.Tip: As you can probably tell, I think using DynaActionForms is less than ideal. However, I will cover them. I feelDynaActionForms are not really dynamic at all since you have to restart the web application when you changethem. I prefer to code my forms in Java instead of XML. I find DynaActionForms no more dynamic than usingJava classes. I prefer to create my ActionForms by subclassing ActionForm and using bean properties. I findthat modern IDEs make short work of adding JavaBean properties. I see no real advantage to using DynaActionForms

District Collectorate

Page 64: District Collector Ate

Abstract over ActionForms. If I want to make an ActionForm dynamic, I add a mapped back property. I haveworked on projects that forced DynaActionForms. I much prefer regular ActionForms. With subclassing Action-Forms, you get strongly typed properties, IDE code completion, and XDoclet support. The XDoclet material iscovered when you cover the Validator framework.Jakarta Struts LiveSession vs. Request Scope ActionForms 84

Session vs. Request Scope ActionFormsA reoccurring question about ActionForms is which scope should I put them in: session or request? The answeris: it depends. Putting ActionForms in session scope may work out really well for web applications with rich userinterfaces. ActionForms in the session scope will ease the development process.Whether you put ActionForms in session scope or request scope depends on what type of application you arebuilding. If you are building an application similar to eBay or Amazon.com, then a different set of rules willapply than if you are writing an intranet application for a company with 500 workers. Don’t exclude putting anythingin session scope as a knee jerk reaction. Putting objects like ActionForms into session scope can make iteasier to create a rich GUI environment.However, as a general rule, you should limit how much you put into session scope as it uses up memoryresources until either you remove the object from scope or the user’s session times out. Resources are usurpedfurther when you implement session sharing via a cluster of J2EE application servers because you are now eatingup both memory resources and network bandwidth. This is not a suggestion that you refrain from putting anythinginto session scope, but simply a warning that you are careful with what you put into session scope.To determine how much you can put into session scope, you should do some capacity planning and hardwarearchitecture planning for your web application. How many users will use the application? Is hardware failoverrequired? Is session failover required? Will you use load balancing? Will you focus on scaling up or scaling out?How much down time is allowed? How much money can be spent on hardware?If you decide to put ActionForms into session scope, you can help conserve resources in a few ways. If you arebuilding a wizard-style interface like a multi-step User Registration form, be sure to remove the ActionFormfrom session scope on the last step of the wizard or when the user presses the Cancel button. For a shopping cart,make sure you remove the shopping cart ActionForm from session scope after the user finishes checking out.Always implement a log out feature. Study how the web application is going to be used and only make the session

District Collectorate

Page 65: District Collector Ate

Abstract timeout as long as is needed; this process can be refined once the site goes live by studying how users areusing the system. (Ex. One company I consulted with set the session time out to six minutes, which was perfectfor their application.)Note: I helped create an ASP (application service provider systems) that almost always put ActionForms intorequest scope. We used hidden fields and cookies to help manage state. I’ve also helped create a B2B applicationwith a known number of users with a rich HTML GUI that almost always put ActionForms into sessionscope.

The Validator FrameworkThe Validator framework is used to validate fields. Validation is done in many forms—for example, a zip code inboth a user registration form and an order form. Instead of writing the zip code validation twice (in each of thevalidate methods of the form beans corresponding to these forms), you can create a general validation mechanismfor all zip code numbers in the system.Since Struts was built with i18N in mind, the validation mechanism that ships with Struts has support for internationalization.The Validator framework provides many common validation rules. In addition to the common validationrules, you can write your own rules using the Validator framework. By the end of this chapter, you will beable to use the common validation rules to validate form fields and create your own validation rules.This chapter covers the following topics:• Understanding how the Validator framework integrates with Struts• Using the Validator framework with static ActionForms and with DynaActionForms• Working with common validation rules• Building and using your own validation rules (zip code with plus 4)• Working with wizards (multistep user registration) by employing the page attribute• Using the Validator framework and your own custom validation at the same time• Employing JavaScript validation on the client sideJakarta Struts LiveGetting Started with the Validator Framework 123

Getting Started with the Validator FrameworkIt’s hard to get started with the Validator framework, so let’s go right into the tutorial.Let’s use the Validator framework to validate fields from the user registration form. As part of this user registration,you want the end user to enter a username. The username should start with a letter, consist of at least 5alphanumeric characters or underscores, and be no longer than 11 characters.To use the Validator framework, follow these steps:1. Add the Validator plug-in to the Struts configuration file. The Validator framework integrates with

District Collectorate

Page 66: District Collector Ate

Abstract Struts via this plug-in, which is responsible for reading the configuration files for the Validator rules.To use the Validator framework with Struts, you need to add this plug-in after any message resourceelements in the Struts configuration file as follows:<plug-inclassName="org.apache.struts.validator.ValidatorPlugIn"><set-propertyproperty="pathnames"value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/></plug-in>2. Copy the validator-rules.xml and validation.xml files into WEB-INF (from the blank Struts webapplication). The validator-rules.xml file serves as the deployment descriptor for validation rule components.Since the user registration is based on the blank WAR file, you don’t have to perform thisstep for the tutorial.For now, you will use a common, preexisting validation rule component so that you do not have tomodify the validator-rules.xml file. The validator.xml file enables you to set up the mappings fromthe ActionForm's property to the rules and any error message for the rules. Examples of both the validator-rules.xml file and the validation.xml file are in the blank starter web application that ships withStruts.Jakarta Struts LiveGetting Started with the Validator Framework 1243. Change the ActionForm class (UserRegistrationForm.java) to the subclass ValidatorForm(org.apache.struts.validator.ValidatorForm). The ValidatorForm is the Struts hook into the Validatorframework. The ValidatorForm overrides the validate() method of the ActionForm and communicateswith the Validator framework to validate the fields of this form.Here are the changes you need to make to UserRegistrationForm.java:import org.apache.struts.validator.ValidatorForm;public class UserRegistrationForm extends ValidatorForm {…private String userName;public String getUserName() {return userName;}public void setUserName(String string) {userName = string;}…4. Add a form to the form set in the validation.xml file. You may recall that the userRegistrationForm ismapped into the struts-config.xml file as follows:

District Collectorate

Page 67: District Collector Ate

Abstract <form-beans><form-bean name="userRegistrationForm"type="strutsTutorial.UserRegistrationForm" />Then, the above form is used by the action mapping as follows:<action path="/userRegistration"type="strutsTutorial.UserRegistrationAction"name="userRegistrationForm"attribute="user"input="/userRegistration.jsp">...<forward name="success" path="/regSuccess.jsp" /><forward name="failure" path="/regFailure.jsp" /></action>You must add the mapping from the userRegistrationForm bean definition in the struts-config.xmlfile to the rules that should be invoked for the individual properties of the userRegistrationForm bean:<formset><form name="user">...</form></formset>Jakarta Struts LiveGetting Started with the Validator Framework 125This code states that you are going to write rules for the properties of the form bean that is associatedwith the attribute user as defined in the struts-config.xml file. The name has to match the attributevalue of the form bean for a mapping that you defined in the struts-config.xml file earlier.Warning! Do not match the name of the form, but the value of the attribute. This gets confusing because if you donot give an action mapping an attribute (attribute="user") , then the value of the attribute defaults to the nameof the ActionForm (name="userRegistrationForm"). Thus, if you did not specify the attribute, the attribute wouldhave been userRegistrationForm and you would use userRegistrationForm for the name of the form in theformset in the validation.xml file.5. Add a field to the form declaration in the validation.xml file corresponding to the userName field.Now that you specified which form you want to associate with rules, you can start associating fields(also known as bean properties) with the predefined rules: the field sub-element maps inputForm'suserName property to one or more rules.<form name="user"><field property="userName" ...>...</field></form>6. Specify that the userName field corresponds to the required, minlength, and maxlength rules:

District Collectorate

Page 68: District Collector Ate

Abstract <form name="user"><field property="userName"depends="required,minlength,maxlength">...</field></form>The depends attribute of the field element takes a comma-delimited list of rules to associate with thisproperty. Therefore, this code associates the userName property with the required, minlength, andmaxlength rules. These rules are some of the many rules built into the Validator framework. Theserules are associated with rule handlers and an error message key. For example, if you looked up theminlength rule in the validator-rules.xml file, you would see the following:<validator name="minlength"classname="org.apache.struts.validator.FieldChecks"method="validateMinLength"...depends=""msg="errors.minlength">...</validator>Jakarta Struts LiveGetting Started with the Validator Framework 126Notice that the validator element defines the minlength rule. It also uses the classname attribute tospecify the rules handler, the class that implements the rule. In the example, the handler for this rule isimplemented in the class org.apache.struts.validator.FieldChecks by the validateMinLength()method. The msg attribute specifies the key for the message that the framework will look up in theresource bundle to display an error message if the associated fields do not validate. You will need toadd this message to the resource bundle.7. Add the error message for the rules to the resource bundle. Because you are using the common rules,you must import its associated message into the resource bundle for this web application. The validator-rules.xml file has sample messages for all of the rules in a commented section. You may changethe wording, but the sample messages are a good guide. Find the sample messages (e.g., errors.minlength)in the comments of validator-rules.xml, and copy and paste the errors to the resource bundle.(If you are using the blank WAR file as the base, the error messages are already in the resource bundle.)The resource bundle for the tutorial is located in resources/application.properties in the src/javadirectory. Ensure the resource bundle contains the following messages:

District Collectorate

Page 69: District Collector Ate

Abstract errors.invalid={0} is invalid.errors.maxlength={0} cannot be greater than {1} characters.errors.minlength={0} cannot be less than {1} characters.errors.range={0} is not in the range {1} through {2}.errors.required={0} is required.errors.byte={0} must be a byte.errors.date={0} is not a date.errors.double={0} must be a double.errors.float={0} must be a float.errors.integer={0} must be an integer.errors.long={0} must be a long.errors.short={0} must be a short.errors.creditcard={0} is not a valid credit card number.errors.email={0} is an invalid e-mail address.Notice the three error messages below correspond to the three rules that you are configuring:required, minlength, and maxlength.errors.maxlength={0} cannot be greater than {1} characters.errors.minlength={0} cannot be less than {1} characters.errors.required={0} is required.Notice that the maxlength rule message (errors.maxlength) takes two arguments ({0} and {1}) asdoes the minlength rule. The required rule message only takes one argument. You will need to configurevalues for these arguments. The first argument of all three rules corresponds to the label of thefield. The second argument for the length rules corresponds to cardinality of the characters. Seejava.text.MessageFormat API docs for more information on working with messages and arguments tomessages.Jakarta Struts LiveGetting Started with the Validator Framework 1278. Specify that the username label is the first argument to the error message. Notice for example that theerrors.minlength message takes two arguments. The first argument is the name of the field as itappears to the end user (i.e., the label). The second argument is the value of the minlength variable(you will set up the second argument later). To set up the first argument, use the arg0 element as follows:<form name="user"><field property="userName"depends="required,minlength,maxlength"><arg0 key="userRegistration.userName"/>…</field></form>The arg0 element passes the key of the message resource, userRegistration.userName. Therefore,the error message in this example will display the userRegistration.userName message, which is

District Collectorate

Page 70: District Collector Ate

Abstract the label for the userName field.9. Configure the value of the minlength value to 5 and the maxlength to 11. Rules take parameters. Thisparticular rule takes a parameter that tells it what the numeric value of the minimum length is. To seta parameter, you use the var element as follows:<form name="user"><field property="userName"depends="required,minlength,maxlength,match"><arg0 key="userRegistration.userName"/><var><var-name>minlength</var-name><var-value>5</var-value></var></field></form>The minlength rule has a variable called minlength (rule names and variable names do not alwaysmatch). The var element has two sub-elements that specify the name of the parameter and the value ofthe parameter. In addition to setting up the minlength rule to 5, you need to set up the maxlength ruleto 11 as follows:<var><var-name>maxlength</var-name><var-value>11</var-value></var>Jakarta Struts LiveGetting Started with the Validator Framework 12810. Specify that:• The value of the rules’ minlength variable is the second argument (arg1) to the error messageif the minlength rule gets actuated.• The maxlength variable is the second argument (arg1) if the maxlength rule is actuated.Therefore, instead of getting the argument from the resource bundle, you want to get it from the variablethat you just defined. To do this, you must specify another argument. This time, use the arg1 element:<field property="userName"depends="required,minlength,maxlength"><arg0 key="userRegistration.userName"/><arg1 key="${var:minlength}"name="minlength"resource="false"/><var><var-name>minlength</var-name><var-value>5</var-value></var><var><var-name>maxlength</var-name><var-value>11</var-value>

District Collectorate

Page 71: District Collector Ate

Abstract </var></field></form>Notice that the code sets the resource attribute equal to false (resource="false"), which means thatthe second argument will not be looked up in the resource bundle. Instead, the second argument willuse the minlength variable defined in the previous step. To do this, the key attribute is set to${var:minlength) (key="${var:minlength}), which states that the value of the second argument isequal to the value of the minlength variable (in kind of a bastardized JSTL expression).The name attribute of arg1 states that this second argument is appropriate only for the minlength rule(name="minlength"). Thus, the second argument will be the value of the minlength variable only ifthere is a validation problem with the minlength rule. Remember that the property can be associatedwith many rules because the depends attribute of the field element takes a comma-delimited list ofrules to associate with the property. Therefore, the name attribute specifies which rule this argumentis used with.Now set the first argument for the maxlength rule as follows:<arg1 key="${var:maxlength}"name="maxlength"resource="false"/>Jakarta Struts LiveGetting Started with the Validator Framework 129If the above seems like a lot of work, don’t fret. Once you set up the framework, using additionalrules is easy. The following listing shows the rules for your user registration form so far:<formset><form name="user"><field property="userName"depends="required,minlength,maxlength"><arg0 key="userRegistration.userName"/><arg1 key="${var:maxlength}"name="maxlength"resource="false"/><arg1 key="${var:minlength}"name="minlength"resource="false"/><var><var-name>minlength</var-name><var-value>5</var-value></var><var><var-name>maxlength</var-name><var-value>11</var-value>

District Collectorate

Page 72: District Collector Ate

Abstract </var></field></form></formset>Now to get this to run, you will need to comment out your old validate() method so that the validate()method defined by ValidatorForm can execute. As part of this user registration, the code above makesthe username a required field, consist of at least 5 characters, and no longer than 11 characters. It doesnot ensure that the first character is a letter and the remaining characters are alphanumeric, you willdo that later after you cover the mask rule.The last step before you start testing what you have done is to turn on logging. Edit your log4j.propertiesfile (see chapter 1 if you don’t know what this is), and add these two entries:#For debugging validator configurationlog4j.logger.org.apache.commons.validator=DEBUGlog4j.logger.org.apache.struts.validator=DEBUGNow read through the log file as your web application gets loaded and the user registration gets submitted.Doing this will help you understand how the Validator framework works and will help youdebug it when things go wrong. When you are done with this chapter, you can set the above back toWARN.Jakarta Struts LiveCommon Validator Rules 130

Common Validator RulesBefore you start writing your own rules, you should become familiar with Table 4.1, which describes the standardrules included with the framework. As you can see, you get a lot of functionality with very little work.Let's cover using several combinations of the rules from the table and see the ramifications of doing so. Not all ofthe rules are covered—just the most useful ones.Table 4.1: Common Validator RulesRule Name(s) Description Variable(s)required The field is required. It must be present for theform to be valid.Noneminlength The field must have at least the number ofcharacters as the specified minimum length.The minlength variable specifiesthe minimum allowednumber of characters.maxlength The field must have no more characters thanthe specified maximum length.The maxlength variable specifiesthe maximum number ofcharacters allowed.intrange, floatrange,doublerange

District Collectorate

Page 73: District Collector Ate

Abstract The field must equal a numeric value betweenthe min and max variables.min variable specifies start ofthe rangemax variable specifies end ofthe rangebyte, short, integer,long, float, doubleThe field must parse to one of these standardJava types (rules names equate to theexpected Java type).Nonemask The field must match the specified regularexpression (Perl 5 style).The mask variable specifiesthe regular expression.date The field must parse to a date. The optionalvariable datePattern specifies the date pattern(see java.text.SimpleDateFormat in the Java-Docs to learn how to create the date patterns).You can also pass a strict variable equal tofalse to allow a lenient interpretation of dates(i.e., 05/05/99 = 5/5/99). If you do not specifya date pattern, the short date form for the currentlocale is used (i.e., DateFormat.SHORT).datePatterndatePatternStrict

creditCard The field must be a valid credit card number

SYSTEM DESIGN

Logical Design:

The system has to be developed from the existing manual system.

Study of the manual system is done thoroughly

All the entries (both internal & external) that affect the system

are identified.

Relationships between the entities are identified.

All attributes and constraints of each attribute are determined.

All the entities are normalized for eliminating redundancy and to

achieve functional dependency.

District Collectorate

Page 74: District Collector Ate

Abstract

Physical Design:

Its schema defines the basic design of a database. The schema is the

model, plan or structure around which fields, records and files are

organized. The particular schema selected depends upon many factors,

including the kind and data type to be processed, the number and type of

users, and the hardware available.

The organization of data in the database is aimed to achieve two major

objectives.

Data integrity

Data independence

In relational database such as those created using oracle, we store

information about different subjects in separate tables. To bring the

information together in a meaningful way, we then tell database how the

different subjects relates to each other.

To design a database

We have to decide which facts we want databases to store.

Determine the tables

Divide the information into separate subjects. Each subject will be in

the database.

Determine the fields.

Decide what information we want to store in each table. Each

Field is displayed as a column in the table.

Determine the relationship between information.

Look at each table and decide how the data in each table is related to

the data on other tables in the database.

District Collectorate

Page 75: District Collector Ate

Abstract Add fields to tables or create new tables if necessary.

Determine the relationships between tables.

Refine our designs.

Analyze the design for errors.

Input design

Input design includes data mediums used for inputting data and validations that

are to be done during data entry. Different messages regarding data are given to

guide users during data entry. Validation checks are done for each input.

Data entry screens are designed so that the system interacts with the user in

providing an effective dialogue. Fields in the screen are logically arranged to help

the user.

The design is the process of converting the user-originated inputs into a

compute-based format. The goal of the input design is to make the data entry

easier, logical and free from error. Errors in the input data are controlled by input

design.

The application has been developed in a user-friendly manner. The windows

have been designed in such a way that during the processing the cursor is placed

in the position where the data must be entered. If any of the data going into the

system is wrong then the process and output will magnify these errors.

The decisions made during design of input is:

1) To achieve the highest possible level of accuracy.

2) To provide a list of possible choices and help while accepting the

input for an important field wherever possible outputs from computer

system are required primarily to communicate the results of processing

to the users. They are also used to provide a permanent copy of these

results for later consultation/verification.

District Collectorate

Page 76: District Collector Ate

Abstract

Output Design

Output refers to the results and information that are generated by the system.

Output is the main reason for developing the system and based on this, the usefulness

and applicability of system are evaluated.

Outputs from computer systems are required primarily to communicate the

results of processing to users. Efficiently designed outputs enhance the

understandability of the information.

According to the requirements of the system, various types of outputs are

considered and designed as follows.

1) Internal outputs, whose destination is within the organization and

which require careful design because they, are the user’s main

interface with the computer.

2) Interactive outputs, in which the user communication with the

Computer is essential.

Events

The following is the list of events that will take place in the system, which will

cause flow of input system

External events

The administrator has to enter his username and password.

The user has to fill in the details in the certificate form.

The user has to enter his User name and Password.

After entering his authentication details, he gains access to site where

he can apply for the certificate, passport application.

District Collectorate

Page 77: District Collector Ate

Abstract Once data validation is completed, the server stores the applicants info

in the database which will be seen by the administrator for further

processing.

The administrator can approve/reject the certificate after verification or

he can passport details of the applicant to a police station.

The administrator can post the details of the work.

The registered contractors can post the tenders for a specific work.

Error Design

Errors are always likely to occur and it is important to provide means to

handle them. These are two basic kinds of errors

Compile time errors : The error that occurs during compilation of a

program.

Run time errors : The error that occurs during execution. In JAVA

run time errors are called exceptions and the

process of dealing with them is called exception

handling.

Listed below are the sources of errors

User Input errors : These are typing errors, invalid data etc.

Physical Limitations : These errors occurs with respect to physical

entitles or capacities. For example space is not

available on disk drives or out of primary

memory.

Code Error : Errors that when logic is wrong, popping empty

stacks, locating non-existing files, data structures

etc.

District Collectorate

Page 78: District Collector Ate

Abstract

Database Design

Contractor

Field Name Data Type Constraint

PK VARCHAR2 (15) PRIMARY KEY

CNAME VARCHAR2(25)

CADDR VARCHAR2(60)

BID VARCHAR2(15)

BNAME VARCHAR2(25)

BADDR VARCHAR2(60)

YEARS VARCHAR2(5)

PWD VARCHAR2(15)

Tender

Field Name Data Type Constraint

TID VARCHAR2(15) PRIMARY KEY

TNAME VARCHAR2(25)

WORKPLACE VARCHAR2(25)

TDESC VARCHAR2(60)

FLAG NUMBER(1)

PK VARCHAR2(15) FORIEN KEY

District Collectorate

Page 79: District Collector Ate

Abstract

Tcassign

Field Name Data Type Constraint

TID VARCHAR2(15) FORIEN KEY

PK VARCHAR2(15) FORIEN KEY

NODAYS VARCHAR2(5)

AMT VARCHAR2(10)

Policest

Field Name Data Type Constraint

PK VARCHAR2(15)

PNAME VARCHAR2(25)

ADDR VARCHAR2(60)

LOGIN VARCHAR2(15) PRIMARY KEY

PWD VARCHAR2(15)

District Collectorate

Page 80: District Collector Ate

Abstract

Passportcertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

BCID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

DOB DATE

SEX VARCHAR2(8)

SPOUSE VARCHAR2(15)

FNAME VARCHAR2(25)

MNAME VARCHAR2(25)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

BIRTHPLACE VARCHAR2(50)

TELENO NUMBER(10)

MOBILENO NUMBER(10)

EMAILID VARCHAR2(25)

EDUQUL VARCHAR2(25)

PROF VARCHAR2(25)

IDMARK VARCHAR2(25)

HEIGHT NUMBER(5)

FLAG NUMBER(1)

PFLAG NUMBER(1)

PK VARCHAR2(15)

Page 81: District Collector Ate

Abstract

Birthcertificate:

FIELD NAME DATA TYPE CONSTRAINT

BCID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

DOB DATE

SEX VARCHAR2(8)

CAST VARCHAR2(10)

BIRTHPLACE VARCHAR2(50)

DRNAME VARCHAR2(30)

FOCCUP VARCHAR2(30)

DOR DATE

FLAG NUMBER(1)

HOSPITAL VARCHAR2(30)

Deathcertificate

District Collectorate

Page 82: District Collector Ate

Abstract

Widowcertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

DCID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

FNAME VARCHAR2(25)

MNAME VARCHAR2(25)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

DOD DATE

SEX VARCHAR2(8)

CAST VARCHAR2(10)

DEATHPLACE VARCHAR2(50)

DRNAME VARCHAR2(30)

REASON VARCHAR2(20)

OCCUPATION VARCHAR2(30)

DOAPP DATE

FLAG NUMBER(1)

DOB DATE

HOSPITAL VARCHAR2(20)

Page 83: District Collector Ate

Abstract

Incomcertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

WID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

HUSNAME VARCHAR2(25)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

DEATHCERID VARCHAR2(10)

REASON VARCHAR2(20)

OCCUPATION VARCHAR2(30)

DOAPP DATE

FLAG NUMBER(1)

DOD DATE

DEATHPLACE VARCHAR2(30)

HOSNAME VARCHAR2(30)

DRNAME VARCHAR2(30)

Page 84: District Collector Ate

Abstract

Residentialcertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

IID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

FNAME VARCHAR2(25)

DOB DATE

QUALF VARCHAR2(20)

OCCUPATION VARCHAR2(25)

INCOME NUMBER(15,2)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

PURPOSE VARCHAR2(20)

DOAPP DATE

FLAG NUMBER(1)

Page 85: District Collector Ate

Abstract

Domcilecertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

IID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

FNAME VARCHAR2(25)

DOB DATE

CASTE VARCHAR2(20)

OCCUPATION VARCHAR2(25)

LIVINGSINCE NUMBER(3)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

REASON VARCHAR2(20)

PURPOSE VARCHAR2(20)

DOAPP DATE

FLAG NUMBER(1)

Page 86: District Collector Ate

Abstract

Minoritycertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

DID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

FNAME VARCHAR2(25)

DOB DATE

OCCUPATION VARCHAR2(25)

LIVINGSINCE NUMBER(3)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

REASON VARCHAR2(20)

PURPOSE VARCHAR2(20)

DOAPP DATE

FLAG NUMBER(1)

CASTE VARCHAR2(20)

Page 87: District Collector Ate

Abstract

Castcertificate:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

MID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

FNAME VARCHAR2(25)

DOB DATE

OCCUPATION VARCHAR2(25)

RELIGION VARCHAR2(20)

INCOME NUMBER(20,2)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

SEX VARCHAR2(8)

PURPOSE VARCHAR2(20)

DOAPP DATE

FLAG NUMBER(1)

Page 88: District Collector Ate

Abstract

Users_Details:

District Collectorate

FIELD NAME DATA TYPE CONSTRAINT

CID VARCHAR2(10) PRIMARY KEY

FIRSTNAME VARCHAR2(15)

LASTNAME VARCHAR2(15)

FNAME VARCHAR2(25)

DOB DATE

CASTE VARCHAR2(10)

OCCUPATION VARCHAR2(25)

RELIGION VARCHAR2(20)

INCOME NUMBER(20,2)

RESADDRESS VARCHAR2(100)

PERADDRESS VARCHAR2(100)

SEX VARCHAR2(8)

PURPOSE VARCHAR2(20)

DOAPP DATE

FLAG NUMBER(1)

FIELD NAME DATA TYPE CONSTRAINT

USER_NAME VARCHAR2(20) PRIMARY KEY

USER_PWD VARCHAR2(20)

PROFILEID NUMBER(1)

Page 89: District Collector Ate

Abstract

Screens

District Collectorate

Page 90: District Collector Ate

Abstract

UML Diagrams

District Collectorate

Page 91: District Collector Ate

Abstract

SYSTEM TESTING

Testing is a process of executing a program with the indent of

finding an error. Testing is a crucial element of software quality assurance and

presents ultimate review of specification, design and coding.

System Testing is an important phase. Testing represents an interesting

anomaly for the software. Thus a series of testing are performed for the

proposed system before the system is ready for user acceptance testing.

A good test case is one that has a high probability of finding an as

undiscovered error. A successful test is one that uncovers an as undiscovered

error.

Testing Objectives

District Collectorate

Page 92: District Collector Ate

Abstract 1. Testing is a process of executing a program with the intent of finding an

error

2. A good test case is one that has a probability of finding an as yet

undiscovered error

3. A successful test is one that uncovers an undiscovered error

Testing Principles

All tests should be traceable to end user requirements

Tests should be planned long before testing begins

Testing should begin on a small scale and progress towards testing in

large

Exhaustive testing is not possible

To be most effective testing should be conducted by a independent

third party

The primary objective for test case design is to derive a set of tests that has the

highest livelihood for uncovering defects in software. To accomplish this

objective two different categories of test case design techniques are used. They

are

- White-box testing.

- Black-box testing.

White-box testing

White box testing focus on the program control structure. Test cases are

derived to ensure that all statements in the program have been executed at

least once during testing and that all logical conditions have been executed.

District Collectorate

Page 93: District Collector Ate

Abstract

Block-box testing

Black box testing is designed to validate functional requirements without

regard to the internal workings of a program. Black box testing mainly focuses on

the information domain of the software, deriving test cases by partitioning input

and output in a manner that provides through test coverage. Incorrect and missing

functions, interface errors, errors in data structures, error in functional logic are

the errors falling in this category.

Testing strategies

A strategy for software testing must accommodate low-level tests that are

necessary to verify that all small source code segments has been correctly

implemented as well as high-level tests that validate major system functions against

customer requirements.

Testing fundamentals

Testing is a process of executing program with the intent of finding error. A

good test case is one that has high probability of finding an undiscovered error. If

testing is conducted successfully it uncovers the errors in the software. Testing cannot

show the absence of defects, it can only show that software defects present.

Testing Information flow

Information flow for testing flows the pattern. Two class of input provided to

test the process. The software configuration includes a software requirements

specification, a design specification and source code.

Test configuration includes test plan and test cases and test tools. Tests are

conducted and all the results are evaluated. That is test results are compared with

expected results. When erroneous data are uncovered, an error is implied and

debugging commences.

District Collectorate

Page 94: District Collector Ate

Abstract

Unit testing

Unit testing is essential for the verification of the code produced during the

coding phase and hence the goal is to test the internal logic of the modules. Using the

detailed design description as a guide, important paths are tested to uncover errors

with in the boundary of the modules. These tests were carried out during the

programming stage itself. All units of Exam Web were successfully tested.

Integration testing

Integration testing focuses on unit tested modules and build the program

structure that is dictated by the design phase.

System testing:

System testing tests the integration of each module in the system. It also tests

to find discrepancies between the system and it’s original objective, current

specification and system documentation. The primary concern is the compatibility of

individual modules. Entire system is working properly or not will be tested here, and

specified path JDBC connection will correct or not, and giving output or not are tested

here these verifications and validations are done by giving input values to the system

and by comparing with expected output. Top-down testing implementing here.

Acceptance Testing:

This testing is done to verify the readiness of the system for the

implementation. Acceptance testing begins when the system is complete. It’s

purpose is to provide the end user with the confidence that the system is ready for

use.

It involves planning and execution of functional tests, performance tests and

stress tests in order to demonstrate that the implemented system satisfies its

requirements.

District Collectorate

Page 95: District Collector Ate

Abstract Tools to special importance during acceptance testing include:

Test coverage Analyzer – records the control paths followed for each test case.

Timing Analyzer – also called a profiler, reports the time spent in various

regions of the code are areas to concentrate on to improve system performance.

Coding standards – static analyzers and standard checkers are used to inspect

code for deviations from standards and guidelines.

Test Cases

Test cases are derived to ensure that all statements in the program have

been executed at least once during testing and that all logical conditions have

been executed.

Using White-Box testing methods, the software engineer can drive test cases that

Guarantee that logical decisions on their true and false sides.

Exercise all logical decisions on their true and false sides.

Execute all loops at their boundaries and with in their operational bounds.

Exercise internal data structure to assure their validity.

The test case specification for system testing has to be submitted for review before

system testing commences.

S No Test Case Action taken

1 Received invalid Admin username and password

Displays error message

2 Received correct Admin username and password

Displays Administration home page

3 Received invalid UserId and password Error message

4 Received correct UserId and password Displays users home page

5 Don’t enter some data in the text fields of the certificate form

Displays error message

6 Approve the user certificate Displays status as approved for the application

7 Reject the user certificate Displays status as reject for the application

8 Get the passport applicant list List of passport applicants will be displayed

District Collectorate

Page 96: District Collector Ate

Abstract 9 Assign passport application to police

stationIt needs to be forwarded to that police station

10 Login into the police station Pending passport applicants list needs to be displayed

11 create a registered contractor New contractor info has to be

stored in the database

12 Post new contract info It should be displayed to all the

registered contractors

13 Login as contractor Work details will be displayed

Drives and Stubs: Since all procedures and functions that verify, validate inputs are

included in testing, no stub need to be written. The test cases are kept in file and

driver is written to read the test cases and invoke the test unit with the different test

cases.

Software testing is one element of a broader topic that is often referred to as a

verification and validation. Verification refers to the set of activities that refers to a

different set of activities that ensure the software has been built is traceable to

customer requirements.

Verification : “ Are we building the product right”

Validation : “Are we building the right product”

The definition of V&V encompasses many of the activities that we have

referred to as software quality assurance(SQA). The activities required to achieve it

may be viewed as a set of components.

Validation testing succeeds when the system functions according to the user

expectations.

Alpha test is conducted at the developer’s site. It is conducted in a

controlled environment.

District Collectorate

Page 97: District Collector Ate

Abstract Beta test is conducted at one or more customer sites by the end user

of the software.

Validation testing is the step where requirement established as apart of the

software requirements analysis are validated against the software meet all-

functional and behavioral performance requirements and the errors, which are

uncovered during the testing, are corrected. Form level and as well as field level

validations are performed in all the data entry screens.

Implementation

The most crucial phase of any project is the implementation. This includes all

those activities that take place to convert from the old system to the new system. It

involves setting up of the system for use by the concerned end user. A successful

implementation involves a high level of interaction between the analyst, programmers

and the end user. The most common method of implementation is the phased

approach, which involves installation of the system concurrently with the existing

system. This has its advantage in that the normal activity carried out, as part of the

existing system is anyway hampered. The end users are provided with sufficient

documentation and adequate training in the form of demonstration/presentation in

order to familiarize with the system.

The working of the system was under observation for a period of two days

after implementation and it was found to the hassle free. The feedbacks from the users

are awaited.

CONCLUSION

“District Collectorate System ” has been developed after a detailed study of

the existing manual system. After the completion of the coding of the projects, the

District Collectorate

Page 98: District Collector Ate

Abstract developed application was tested on live data to check the accuracy of the data

manipulation and their associated outcomes.

This application software is advantageous and highly useful, overcoming the

conventional techniques, which were not easy. More over, it takes lot of time to

perform the operations in collectorate office manually. The software developed

eradicates all those hurdles and easy to use and satisfies all the necessary formalities.

It has been developed with systematic design principles confirming to the step of the

system development life cycle. The system has been modularly developed and

implemented interrelation between the modules and thereby overcoming the

drawbacks of the manual system.

“District Collectorate System” provides the better means for online services

process and helps the users to apply for their required service and check the status

from online. The software is user friendly for both the users and the administrator.

BIBLIOGRAPHY

HTML Complete reference - Thomas A.Powell

JavaScript - Ivan Bay Ross

JAVA Servlet Programming - Jason Hunter & William Crawford

District Collectorate

Page 99: District Collector Ate

Abstract Java Complete reference - Patric Naugthon, Herbert Schildt

Struts - Jakarta Struts Live

Software Engineering - Roger S.Pressman

District Collectorate