DESIGN AND DEVELOPMENT OF ON-LINE MULTIPLE-CHOICE EXAMINATION SYSTEM
A PROJECT
SUBMITTED TO THE INSTITUTE OF INFORr"'1ATION AND COMMUNICATION TECHONOLOGY, BUET, IN PARTIAL FULFILMENT OF THE REQUIREMENT FOR THE DEGREE OF POST GRADUATE DIPLOMA IN INFROMATION TECHNOLOGY.
By
Bisnu Pada Biswas
Ahmad Raihan Shahidullah
Student #DF0131007 Student #DF0131008
Md. Soheb Ahmed Student #DF0131018
.~~.(-~~
/..~~~ ~I:':"_:"' ""Y.
~.$'. G] t~ 2$ ,.~~
Under the supervision of ~0<"~~ ~.-1':~5"-/~ j
,l}'"',- __
9*~
Professor Dr. S.M. Lutful Kabir '~,",f\, ~~
1111111111111111111111111111111111
#S7323#
INSTITUTE OF INFORMATION AND COMMUNICATION TECHI'JOLOGY, BUET
OCTOBER, 2002
This is to certify that this work has been done by us and it has not been submitted elsewhere for the award of any degree or diploma.
Countersig ned
Dr S. . utful Kabir Supervisor
Professor and Director IICT,BUET,Dhaka-1000 Bangladesh
Signature of the students
Bisnu Pada Biswas Student #DF0131007
Ahmad Raihan Shahidullah Student #DF0131008
~
Md. Soheb Ahmed
Student #DF0131018
ACKNOWLEDGEMENT
We want to thank almighty Allah, to whom all praises belong.
Almighty gives us capability, knowledge and patience; those we use for achieving goal.
We worked for this project under the supervision of our respected Professor Dr. S.M. Lutful Kabir. We are grateful for his constant guidance, suggestion and invaluable assistance. He assisted us by giving his valuable time throughout the project work. His encouragement and motivation helped us to complete our task.
We also want to give thanks to every person who helped us with their valuable suggestions and assistances.
Volume - I
1. Introduction
1.1 In GeneraL 1
1.2 Prevailing On-Line Examination System 1 1.3 Main features of this development... 2
1.4 Project Paper Layout... 2
2. Development Background
2.1 Development Methodology .4
2.2 Software and Database Used 4
2.3 Imp
I
em e ntati 011 Pia n 53. Database Design
3.1 Description of the Database Developed... 7
3.2 Data Used for the development 8
4. Software Design
4.1 Description of the Software Developed... 9
4.2 Software Testi n9 14
4.3 Softwa re Custo m iza ti0n... 15 4.4 Getti ng Hel p... 16
5. Hardware Requirements
5.1 Basic Hardw are l7
5.2 Netwo rk Envi ro nmen t. 18
5.3 T rou bl es hooti n 9... 21
6. Installation
6.1 Oracl e... 22
6.2 Tomcat... 22
6.3 Softwa re... 22
7. Conclusion and Further Development 7.1 Con cIusion 25 7.2 Fu rther work... 25
References 27 Append ix :... 28
Volume -
II1. Mod u Ie 1... 1
2. Mod u Ie 2... 8
3. Mod u Ie 3... 20
4. Mod u Ie 4... 34
Chapter 1
Introduction
1.1 In general
Examination is a means for evaluating student's abilities, knowledge and potentials for both type of education, formal or informal. Traditional paper based examination is a little bit obsolete in today's world. Recent trend is toward online examination systems.
Development in Technologies especially in the field of communications has intensified the trend. Online examination system has many advantages over paper based examination in the field of global accessibility, simplicity, security, rapid evaluation, standardization, record manipulation and warehousing and even it is possible for a examinee to complete the examination from home.
1.2 Prevailing On-Line Examination System
Formal and informal academic institutions in many countries are now using their own customized software to take on line examinations.
A good example of on-line examination system may be the examinations taken by Cisco Networking Academy. Students need to log into the academy examinations server using ID and password.
After authentication, students get chance to
giveany number of
examinations from available. All scores along with given answers are
stored in Cisco System's central server. Students get the opportunities
to
viewtheir scores anytime by logging into that server. Some other
on-line examination systems are examinations taken by VUE,
Prometric, ETS etc. In our country we don't
havemany institutions
those offer such examination facilities. Many of them
haveresources
but are reluctant to provide such facilities. Cause of this reluctance may be from:
.,. Inertia and familiarity with the old system .,. Unawareness of the recent trend
y
Resource limitation and reluctances to invest in the new system
y
Informal education and computer based education is not well- liked in our country
y
Undeveloped communication infrastructure 1.3 Main features of this development
y
Software has been developed in Java, so it is fully platform independent
y
Oracle has been used as database server. It is as adaptable highly secured, flexible and pioneer of it's kind
y
Tomcat has been used as web server. It is as adaptable, highly flexible, widely used to handle Java Servlets and JSP.
y
Software can be used both in stand alone machine or in network environment
1.4 Project paper Layout
Project paper has been divided into two volumes namely volume-I and volume-II. Volume-I contains detailed descriptions of project development, design, and implementation whereas volume-II contains the source code of the developed software.
Volume-I comprised of seven chapters. Brief descriptions of each chapter are given below:
y
Chapter 1 gives an introduction to the on-line examination
system, benefits over traditional paper based examination
3
and problems in our country's respect. It also includes the main features of the developed software.
,. Chapter 2 describes different aspects considered and followed while developing the software. It also describes various software and database servers those have been used while testing the software. A brief description on how the software could be implemented is also discussed.
,. Chapter 3 deals with the database objects those have been created for successful implementation of the developed software. Some examples of the objects with inserted data have also been shown.
,. Chapter 4 describes major features of the software and outcomes when tested in different environment. Necessary requirements needed to customize the software and related information sources have been discussed.
,. Chapter 5 describes basic hardware resources necessary both for server side and client side machines. Equipment required to implement the software in networking environment has also been discussed. A short description on possible problems and solutions which may help users is also discussed in this chapter.
,. Chapter 6 describes installation procedure of the developed software along with installation of other necessary software.
,. Chapter 7 describes limitations, possibilities to overcome the
limitations and further development of the software.
Chapter 2
Development Background
2.1 Development Methodology
During development of the software following key points were continuously focused and monitored
r
Platform independency
r
Security
r
Optimum flexibility
r
User friendliness
r
Reliability
r
Simplicity
r
Versatility
r
Maintainability
2.2 Software and Database Used
Java has been used as the programming language in developing the software. Some other languages like Visual Basic, Visual C++ may also be used to do the same task. Due to Java's robust flexibility, it , was selected to develop the software. Unique feature that makes Java the best choice is its platform independency. Java Servlet technology has been used extensively to make this web based software. Scripting la'nguages namely VBScript, Javascript, PHP, ASP may also be used to generate web pages. But Servlet supports nearly all features of Java additionally, Servlet generates html pages dynamically.
Tomcat has been used to handle the Servlets and to handle
desired web pages dynamically. Tomcat itself has been developed
5
using Java, so it is also platform independent. Moreover, Tomcat has the ability to handle Servlet which other web servers like lIS, Apache don't have. Developed software has been tested with Tomcat 3.1Ml and Tomcat 3.3.1.
Oracle8i, Oracle9i, MySQL and Microsoft Access database server have been tested and used with this software. Different database servers were tested with this software to ensure that developed software would be a versatile one.
2.3 Implementation plan
First consideration was to make the web based software platform independent, so java was chosen as the language to develop it. As html page generation was felt essential it was decided to use some html generating technique namely PHP, JSP, Jservlet etc. Java Servlet technology has the potential of using full capabilities of java langulage and it is able to generate html pages dynamically, so it was chosen.
Decision was made to make the developed software database independent. But for initial development purpose Microsoft access Database was chosen because of its simplicity. Total task was broken into following modules:
,. Module 1: To develop and test codes necessary for creating database tables
,. Module 2: To develop and test codes necessary for iDserting and manipulating students information in created tables
,. Module 3: To develop and test codes for insertion and manipulation questions in created tables
,. Module 4: To develop and test codes for giving and evaluating
examinations
Decision was made to maintain module's independency, so that developed software can be customized easily later. After successful completion and testing of each module with Access database, the modules were combined and successfully tested. Then it was decided to test the software with MySQL and that test was also successful. At last, effort was given to transform the whole system to work with Oracle, as Oracle is the most powerful database server. It was done successfully and now the software is working fine with Oracle8i/9i.
,
7
Chapter 3
Database Design
3.1 Description of the Database Developed
For simplicity, three types of tables have been designed namely Student table, Teacher table and Exam tables and no relationship has been created between the tables. Brief description of the tables are given below:
, Teacher Table - it has two columns (ID, Exams) holding values for Course ID and Number of Examinations will be taken for the course.
ID - VARCHAR2(15) and PRIMARYKEY Exams - NUMBER(4)
, Student Table - it has columns (ID, Name, Examl, Exam2 , , Examn) holding values for Student Identification Number, Student Name, Examination scores of
everystudents for each examination (No. of examinations mentioned in the Teacher table's Exams column)
ID - VARCHAR2(15) and PRIMARY KEY Name - VARCHAR2(30) and NOT NULL Examl, , Examn - NUMBER(4)
, Exam Table - n number of tables will be created (n=No. of examinations mentioned in the Teacher table's Exams column) with columns (No, Quest, Ansl, Ans2, Ans3, Ans4, Correct) holding values for Question number, Question, Answerl, Answer2, Answer3, Answer4, Correct Answer number for each question.
No - NUMBER(4), UNIQUE_NUMBER and NOT NULL
Quest - VARCHAR2(200) Ans1 - VARCHAR2(50) Ans2 - VARCHAR2(50) Ans3 - VARCHAR2(50) Ans4 - VARCHAR2(50) Correct - VARCHAR2(5)
3.2 Data Used for the Development
These sets of example data for the three tables are shown below:
Teacher table:
ID
IICT -5133
Exam1 table:
Exams
4
NO Quest Ans1 IAns2 Ans3 Ans4 Correct
1 2+3=7 3 4 5
6
32 5*7=7 20 35 30 45 2
3 10-4=7 3 4 5
6
4Student table:
ID Name Exam1 Exam2 Examn-1 Examn
DF0131007 Bishnu 10 7
8
12DF01310017 Karim
6 8 8
10DF01310025 Dipta
6 8 8
109
Chapter 4
Software Design
4.1 Description of the Software Developed
Developed software is web based On-Line Multiple Choice Examination System software. User's request from web browser will be caught and processed by servlets. Connection with the database for authentication should also be handled by servlets. According to user's need servlet will generate and send necessary web pages to users web browser.
Tables (Teacher table, E,xaml, Exam2, , , Examn tables, and Student table) can be created automatically using the following page for inserting information
1'1•••• "nln('olln. II>(S'''''&I
r---- Ir,---
$._1
----_.,._---_...--_.-----
,,-
l'l"'ue EllIffSlud"111 Nalllf' (5Irl"C"
Students registration can be done by using the following page
1~1:"IIz:e:::t/Z;dt.il:!l:l..c::I':Z:\:::!!II.I:.:i::'~I::.illZ:i_C~:.lIHll:jI:"::::.i::- •__._."~II_I!II_ !Ill!1l:!!l!~!I_~~miKli_:::.!::!_!lI:!_il'.;::iii'••••::I1;;"",!!y!:~~:;;r;{!.f.i
1_.J:-.rJ«t .• -,\, •'u:fl, C11 '1lse""h CiJ~~"'t...l}'~.\,1!~~.J ~ . ~ ~oR . .1
1~~;riJi.tlDI"";_'~I-,••;_j;,;;~dl . m _. 3-~Go-!Uft.ooj
.:J
1"''''''='''.---
Pi •.,•••. Ent •.r Stud",,,, ID (Stri"l _ l'ri.nary 11:•.)') IOF01Jl0n
For Deletion only Student ID Required
Student's data manipulation can be done by using the following page
r",
rEx.vrunallonl ro-Exarrunabon2
...-.--.,.---"..----.-...----r--j'-r t!tt1Dl.,-N •• -.-- .:J
Question insertion can be done by using the following page
II
I,i!
...• _,_.-
ii?' !..•
Ai'.•._ .•.. u.!1~!'4- .,U'__ " (J- '..f, .•..3..:J!QI •.:.l~~
.:....•..rti_";;;;.:;,;;..~;.:.:../,,;;~;.'"~~. -,.,-;.~,..__.,_._-
Enl••••••••••••1(S'mtll EnI•• An,,,, •• 2 (stnoe)f EnI •• "" ••••••.,J{~1
Froio<,,"_ •• 4(S>J"'&li
u....C ••• « •.•.•••••••.•1'1 ••(lrl•••,:f---
-"
.1iJ ••••
---'---.---~---.---r,r~~...__
Question manipulation can be done by using the following page
I> I liM i! Il
••. ... - ,_. ,- ..•
.•._ •.•. ~~C1''o:l- .ioI,••••- a-:;'lJ ~.3'.:JiO:':.::.l':'~
.••••.;. [., •••• /""#.,;,. •••••.•••.••.,t- .•.._ .•,,~.
CM
"' .•.•.•_,,1
," A~.-.2 r"'o •••••l CM~
•• C"", An,
t1•••.V_f,.., ••••o..,l ••f~" ••••)
I
-"".J
•••••.~~~';':.J~
:::r~,;-r••• ~
d
Some other pages are also available for performing necessary tasks as seeing every student information, seeing every inserted questions etc.
Using the following page, particular examination can be chosen from available examinations by an examinee
L~.,..H_ 'ob<~
L~ •••••ID['FOIJlOIS
!r-rQ' •••••_
Using the following page number of questions per page can be chosen by an examinee
L~••••II••.•••••.•••
L~"",IDr'Fo1l1019
&_,
»n •• SC.rI bllUD" 10pro~""".
:.fiiiON"---.-.----,."--'--'- ..--,..-.-.-.---- ---.-,.--.--~-.--.--rrrlli;;o ••-;;;o--.oJ
13
Questions will be generated in a different order for every examinee, so possibility of unfair means has been minimized
E',=====i=llljj= ••••_""'£&UlIl:SOLZO""'=".,,."'==."',..,,=-"'-"'-."'~Z:""~ ~::::,,:"..J.L"J
roo •.• _ .-., ._ ••• ~.~.__ -_"' _
.~~ •..•. OU.ll~IQ...;;,--:z'•••.•••'1)_. ;;,,';o ..:.t~.~'t'g . I
~~.l~.!:.--_~~...:_.!~~"....,.""... ~3~~-ij
L~.,110m< ft ••••
lo",,1P l'f01Jl019 QI 2.;<-'
q
. ,
co
-.
Q) (' ••..•••
.~ .
~rt••••••••"".h'•• Chot"" ..•••••
""C_al..
!"1:00»"
Qol 12'"2'2.1
-"
-"
."
'.U .••• ,"""'d
rrri21.---
Examination score will be shown instantly after pressing the Submit button
Lo••• lt...,. •••.•••
t •.••••ID DFOUl019
u_i
YOllr Sc;ore is: J.O In 4.0 Perccnl ••ee I,: 75.00°/0
No examinee will be allowed to take the same exam twice without
examiner's permission.
4.2 Software Testing
Tomcat 3.1M1 and Tomcat 3.3.1 has been used with this software to handle the servlets and to generate dynamically desired web pages. JDK1.2 and JDK1.3 has been used to for developing the software and to cooperate with Tomcat. Software has been tested in Windows98, Windows2000 and Linux platform. No significant problems have been found while testing the software.
In case of Oracle8i, some methods to manipulate the Resultset are not available with the built in JDBC driver. It is highly recommended to download and install the latest JDBC driver, else program may not function properly.
Oracle9i has built in JDBC driver with all necessary methods to manipulate the Resultset.
MySQL 3.23 has built in methods to manipulate Resultset and while tested with this software has not shown any considerable errors.
Microsoft ODBC driver for Access database also has the necessary methods and it is fully functional with the developed software.
Developed software has been tested with different examinees having different number of questions. Scores calculated by the software and scores calculated manually were same. Some examinees name, ID, no of questions tested with and scores are given below
Name ID No. of questions score
Khairul DF0131099 12 10
Tuhin DF0131079 25 19
Rahim DF0131099 30 25
registered for each database aid in finding necessary
154.3 Software Customization
For using other database servers:
,. Some packages needed to be imported in java servlet programs based on database server. Every database servers requites particular package, documentation can be searched for intended database server
,. Particular driver needed to be server. Documentation may information
,. Connection string needed to be created for the database server. It will be found in the documentation of the database server.
,. Java servlet source files needed to be modified using above three steps, source files needed to be recompiled and byte code files needed to be replaced the in the "classes" folder of the web server.
For changing the schema
,. Database administrator has the authority for creating users, privileges and roles.
,. During creation of the database objects given name and password should be used. All tables will be created under given schema
,. User name "scott" and password "tiger" should be chaged with given name and password in every connection string found in LoginCheck.java, GetExam.java, GetMessage.java and GetQuestAns.java. Source files needed to be recompiled and byte code files needed to be replaced the In the "classes"
folder of the web server.
For changing server name and folder name
While requesting the servlets, following should be used
< FORMACTION=http://user server name: SOBO/userfolder/servlet/
user servlet METHOD=POST/GET>
4.4 Getting help
a) For the standard software, the following web addresses or help files may be searched to get help on relevant topics
Oracle
http://www .oracle.com, http://education .oracle.com http://technet.oracle.com/docs/, http://www.orafaq.com
MySQL:
http://www.mysql.com/documentation/
http://www.mysql.com/portal/books/html/index.html.
Microsoft Access Database:
Built in help with the Access Database
JDK:
http://java .sun.com/prod ucts/
Tomcat:
http://jakarta.apache.org
b) To get help for the developed software, contents of the help file (help.txt) in appendix can be seen.
17
Chapter 5
Hardware requirements
5.1 Basic Hardware
Minimum configurations of the hardware required for the developed software are described below:
Server Side:
I Requirement ] Details
I pm"~--.--M-in-i-m-a-I-p-ro-c-e-s-s-o-r-: -P-en-t-iu-m-I-I---.
_ I. Recommended Processor: Pentium III or above
~ • Typical: 256 MB (512 MB recommended)
I • Minimal installation: 128 MB (256 MB
, recommended)
Hard disk
I
I
iWebbrowser IOthers
I
• Typical installation: 2.9 GB
• Minimal installation: 2 GB
• Custom installation: depends on components selected for installation.
• Frames and Java-enabled
• LANCard
Client Side:
r
Requir;;;entlDetail~1--- ---.---.---
i
Processor • Minimal processor: Pentium MMX, Pentiumi
Celeron or equivelant.i •
Recommended Processor: Pentium II or above,---1--- i --'
IRAM • Minimal: 64 MB
I
i •
Recommended: 128MB! I
IH-a--r-d-d-is-k--j---.
-S
p~~_;-~~-~-e_;;sa-r-y-for-i ~~t;jJj-n--g--a-n-y-c-Jj-e--n-t-s--id-e---IL .. ..__. . _
5.2 Network Environment
Considering different issues and aspects, following networking plan have been proposed:
,. Network should be designed in such a way that all connected workstations have the ability to connect to the network in a smooth way. It should have all required software (ex.
authentication server, DNS server) and hardware (ex.
Terminal server, Router) that enable remote user to log into the network as well.
:.- Developed network should be secured and reliable :.- Round trip time of the network should be minimum
:.- Developed network should be designed at a minimum of cost but one that allows for future technologies to be added easily
19
Necessary equipment that may be required to develop a network for local and remote access are listed below:
Device Name No.
Router 1
Terminal Server 1
Switch 2
Hub 4
CAT 5 UTP Cable 500 metre
LAN card 10
Computer 10
Server
Elh
~
Host_ 2 Host_3 Host_4
~ ~ ~
Hose 5 HosC6 HosC 7
~ ~
@J --
Hose 8 Host-9 HosCIO
Possible network diagram
21
5.3 Troubleshooting
The frequently encountered problems and the methods to solve them are listed below:
Problems:
,. Broken or disconnect cables
).- Cables connected to the wrong ports ).- Intermittent cable connection
,. Wrong cables used for the task at hand ).- Transceiver problems or device turned off
,. Improperly configured serial and Ethernet interface ,. Improper clock-rate settings on serial interface ,. Incorrect IP addresses and Subnet Masks ).- Incorrect DNS to IP bindings
Solution:
).- Observe some aspect of the universe and invent a theory that is consistent with what you have observed
).- # Use the theory to make predictions
).- Test those predictions by experiments or further observations ).- Modify the theory in the light of your results.
).- Go to step
#
).- Identify network/user problem
,. Gather data about network/user problem
,. Analyze data to come up with a possible solution to the problem
,. Implement solution to network to attempt correction to the system
).- If the problem isn't resolved, undo previous changes and modify data
,. Go to step #
Chapter 6
Installation
6.1 Oracle
Contents in appendix can be seen
6.2 Tomcat
Contents in appendix can be seen
6.3 Software Step 1:
,. A folder needed to be created in jakarta-tomcatjwebapps folder (Default is Sohebl)
,. Sub-folders of jakarta-tomcatjwebappsjexamples needed to be copied into the created folder
r Html files needed to be placed in the folder created earlier for the application
o table.html o question.html o student.html o exam.html
r Servlet class files needed to be placed in Jakarta
tomcatj
webappsj created folder j WEB-INF jclasses o LoginCheck.class
o GetExam.class o GetMessage.c1ass o GetQuestAns.c1ass o AuthenCheck.class
?' _J
o AuthenCheck1.c1ass o AuthenCheck2.c1ass o CreateTable.class o StudentData.class o QuestionData.class o DeleteRecord.class o DeleteQuestion.c1ass
y A mapping needed to be added for the application by editing the jakarta-tomcat/conf/server.xml .
y Following needed to be added at the end part of this file
<Context path="/Sohebl" docBase="webapps/Sohebl debug = "0" reloadable ="true" >
</Context>
y Web page can be called from web-browser by using the address ''http://localhost: SOSO/Sohebl"
Noted that html file index.html that is placed in jakarta- tomcat/we- bapps/Sohebl will be displayed
y Servlets needed to be registered by editing jakarta- tomcat/webapps/Sohebl/WEB- INF/web.xml file
y Following code for each servlet needed to be added
<servlet>
<servlet-name>
servlet name
</servlet-name>
<servlet-c1ass>
class names of the servlet java file those are placed in jakarta-tomcat/webapps/created folder/WEB-INF/ classes
</servlet-c1ass>
</servlet>
).- Servlets can be called by http://localhost:BOBO/Sohebl/
servlet/servletname
Step 2:
Tomcat needed to be started
Step 3:
Database server needed to be started
Step 4:
;;. Connection to the web server (Tomcat) ''http://server name:BOBO/Sohebll" can be made using web browser from server/client machine
;;. If the html pages mentioned above can be seen, installation is
successful
•
Chapter 7
Conclusion and Further Work
7.1 Conclusion
Design of a program depends upon the style chosen by. the programmer. None can say that his one is the last as better and better solutions are coming everyday. We may have many limitations in our software, some may due to ignorance and some may due to lack of experiences. There are many chances for others to enhance this software. We wish best for our followers to give something better.
7.2 Further work
This software has been designed to take multiple examinations required for a particular course. It is possible to develop the software for taking multiple examinations for multiple courses. Further improvement of the developed software is possible. Some suggestions have been pointed out for the further work:
;... Examination tables Exam 1, Exam2, , Examn can be created by using name ID+Exam 1, ID+Exam2, , ID+Examn, where ID implies Course Identification (Teacher Table's ID Column)
I' Multiple Student table can be created by using name
"ID+Student" for holding student's name, Student's ID and scores for each course.
;... While taking exams student can be given options to choose a particular course from available courses. Then the same method used in the software can be applied to evaluate a particular examination from available designed for a course.
Examination score then can be inserted in the "ID+Student"
table, created for a particular course.
r In student table Examl, Exam2, , Examn columns can be used to store nested table or varray. This nested tablejvarray can be used to store answers given by the student for later verification
r Question bank can be made, from where a given number of questions will populate the exam tables. Database triggers can be used for this purpose
,. While inserting information of a new student in the register office, student table can be updated by using triggers
r An extra column in the student table can be used to hold value for activation or deactivation of the examinations
,. By using multithreading technique, it is possible to monitor examination time and to activate the submit button automatically when time expires
r In the present system with new academic session, it will become difficult to maintain the table with inserted data. It may be possible to add year as "2002" to add with all table names
References
[I] JA VA HOW TO PROGRAM BY DEITEL & DEITEL
[2] JA VA ONLINE TUTORIAL: TRAIL BY MA YDENE FISHER
[3] CORE SERVELETS AND JAVASERVER PAGES BY MARTY HALL [4] ORACLE 8i/9i DOCUMENTATION BY ORACLE CORPORATION
[5] ORACLE8i DBA: ARCHITECTURE AND ADMINISTRATION BY HUNGRY MINDS
[6] JAKARTA TOMCAT DOCUMENTATION
[7] MySQL DOCUMENTATION BY FREE SOFTWARE FOUNDATION
27
Appendix
(From Oracle Documentation) Using Oracle Universal Installer
Oracle Universal Installer automatically installs the Java Runtime Environment (JRE). The JRE is a subset of the Java Developer Kit (JDK). To run Java applications, JRE is required. To develop Java applications, JDK is required.
Non-Interactive Insta IIation
Typically, Oracle Universal Installer can be run in interactive mode. However, installer in non-interactive or silent mode is available for advanced users (such as database administrators), by using a response file. This is a text file containing vai-iables and values used by Oracle Universal Installer during the installation process. Using the silent installation enables to bypass the graphical user interface (GUI) and install Oracle products in silent mode.
To use a response file, response file should be modified and it is located in the \Response folder located at the root of the Oracle8ij9i Enterprise Edition CD-ROM. Accompanying readme.txt file can be seen for more information.
Running the Installation
The following steps describe a Typical, interactive installation of Oracle8ij9i Enterprise Edition for Windows NT. Users, choosing a Minimal or Custom installation may encounter a slightly different set of windows.
To install a Typical installation of Oracle8ij9i Enterprise Edition for Windows NT:
29
.,. Operating system should be started. If Windows NT 4.0 is running, logging to Windows NT server as a member of the Administrators group is required
r All Oracle services should be stopped (if any are running).
For Windows NT 4.0, services can be stopped as follows:
From the Control Panel, services icon can be selected.
If any Oracle services (names begin with Oracle) exist and have the status Started, it should be stopped
.,. OracleSi Enterprise Edition CD-ROM should be inserted into CD-ROM drive. The Autorun page automatically appears. If the Autorun page does not appear, Start > Programs>
Windows NT Explorer should be chosen. The Windows NT Explorer will start
r Navigation to the root directory of the CD-ROM is needed.
SETUP.EXE should be double-clicked. The welcome screen for Oracle Universal Installer will appear and installation will begin
;,.. Selection must be made when prompted by the OracieSi Enterprise Edition -Autorun dialog box:
Add/Remove Products Explore CD
Browse
.,. Selecting Add/Remove Products will begin the installation process. The Welcome window will appear
,. Clicking Next is required. The File Locations window will appear. Source ... field must not be changed
,. Oracle Home name and directory location is required to install OracleSi/9i Enterprise Edition components. The default
appear Space location is <drive with the most available space> :\ORACLE\ORASI or \ORACLE\ORA9I
:,...Clicking Next will proceed. The Available Products window will appear
,. Oracle product should be selected to install (default is OracleSij9i Enterprise Edition)
:,...Clicking Next will proceed. The Installation Types window will appear. Appropriate installation type is required (Typical, Minimal, or Custom)
,. Clicking Next will proceed. The Location for Oracle Documentation window will appear for a Typical or Custom installation. Hard Drive selection to install the documentation will install documentation on the hard drive. Otherwise, documentation will remain on the CD-ROM
:,...Clicking Next will proceed. At this point of the installation, prompt to upgrade database with the Oracle Data Migration Assistant may appear (if Oracle Universal Installer detects an earlier version of an Oracle database on hard drive). Selecting the Migrate an Existing Database check box will make Oracle Data Migration Assistant start immediately after installation to migrate existing database. Click Next. The Database Identification window appears
,. Global Database Name and SID in the fields provided are required
:,...Clicking Next will proceed. The Summary window will listing the Global Settings, Product Languages, Requirements, and New Installations
,. Install should be clicked. After the components are installed, the Configuration Tools window will appear and NetS
31
Configuration Assistant and other appropriate assistants will automatically start in succession. The Configuration Tools window will display the results of running these assistants :.- Clicking Next will proceed. The End of Installation window will
appear.
:.- Clicking Exit is needed to exit from Oracle Universal Installer or clicking Next is needed to install another product.
(From Jakarta Tomcat Documentation) Installing Tomcat
This section deals with installing the Tomcat binary archive available from the Jakarta Project. It is also possible to install Tomcat by building it from source, but that isn't covered here. Downloading of the appropriate jakarta-tomcat-<version> binary archive file is necessary. For Linux, RPMs are also available.
Archive should be expanded into some directory (say /usr/local or C:\). This should create a new subdirectory named "jakarta-tomcat-
<version>". Renaming this directory is also possible. Instructions to use the new name should be followed. For Linux, RPMs may be installed with the command "rpm -Uvh". Command man rpm will give more information.
Environment Setup
There are a number of different methods to start and stop Tomcat. There are differences in the environmental setup needed for these methods. This section addresses the environmental setup needed for using the shell scripts and batch files provided to simplify starting and stopping Tomcat. This section assumes manual starting and stopping of Tomcat from a shell or MS-DOS window.
Setting the environment variable JAVA_HOME is required to point to the root directory of your JDK hierarchy. Optional addition of the Java interpreter to PATH environment variable is possible. The exact directory may vary from system to system. Checking of local file system should be done to be sure where Java is installed.
Win32:
JAVA_HOME=c:/jdk1.3.1
PATH=%JAVA_HOME% \bin; %PATH%
Unix (bash/sh):
JAVA_HOME=/usr/localjjava/jdkl.3.1;
export JAVA_HOME
PATH=$JAVA_HOME/bin: $PATH;
export PATH
Unix (tcsh):
JAVA_HOME=/usr/localjjava/jdkl.3.1 PATH $JAVA_HOME/bin:$PATH
TOMCAT_HOME environment variable is optional. If the supplied shell/batch scripts are executed from "jakarta-tomcat-<vers;on>" or from its "bin" subdirectory, then they will successfully set TOMCAT_HOME if not already set. If these shell/batch scripts needed to be executed from other directories, setting TOMCAT_HOME is mandatory.
33
On Win32 systems:
TOMCAT_HOME=c: \jakarta-tomcat- <version>
On UNIX (using bash/sh):
TOMCAT_HOME=/usr/local/jakarta-tomcat- <version>;
TOMCAT_HOME
On UNIX (using tcsh):
TOMCAT_HOME /usr/local/jakarta-tomcat-<version
>
Starting Tomcat
After opening a shell or MS-DOS window and setting the environment as described in the prior section, starting and stopping of Tomcat can be done.
Tomcat can be started:
On Win32: bin\startup On UNIX: bin/startup.sh
This will start Tomcat in the background on Unix based systems, or in a new MS-DOS window on Windows based systems. A short period of time is needed before Tomcat is ready to serve requests. The very first use will need a little extra time since some WAR files will be expanded by default.
Whether Tomcat has completed can be verified by its startup, when text like the following appears in the log output.
2001-09-01 14:23:30 - Http10Interceptor: Starting on 8080 2001-09-01 14:23:30 - Ajp12Interceptor: Starting on 8007 2001-09-01 14:23:30 - Ajp13Interceptor: Starting on 8009
In Tomcat's default configuration, Tomcat's output log is not assigned to a file. Instead, Tomcat's log output goes stderr. On
Windows systems, switching to the MS-DOS window can be done to see if this test has appeared.
The default Tomcat configuration will service HTTP requests on port 8080. Starting browser with http://localhost:8080/ will present Tomcat's Welcome page.
In addition to serving HTTP, the default configuration will service Ajp12 protocol requests on port 8007 and Ajp13 protocol requests on 8009. These protocols are used by the "connectors" which allow Tomcat to be used as a Servletj]SP container for an external web server, such as Apache. Also, the Ajp12 protocol is used by the Tomcat shutdown process.
Options and system property settings can be passed to the Java VM by specifying them in an environment variable called TOMCAT_OPTS (for instance: '-server' is useful as a performance
enhancement if running Sun's HotSpot VM).
Note: On Win9x, it's not possible to include system property settings in TOMCAT_OPTS because the SET command won't accept a line with more than one equals sign.
The "auto-generated" configuration files for external web servers, such as Apache, are not written during a normal startup of Tomcat. To write the configuration files, append jkconf to the startup command. Tomcat will initialize sufficiently to write the files and then exit. This may be done while the Tomcat is running as a web server.
Stopping Tomcat
To perform a normal shutdown of Tomcat, a special "shutdown"
request must be send from a separate process, or possibly a different computer. In the default configuration, that "shutdown" request must be made using the Ajp12 protocol. If the shell or MS-DOS window used
35
to start Tomcat is not still open, opening a new one is essential and environment should be set as same as for starting Tomcat.
Tomcat can be stopped:
On UNIX: bin/shutdown.sh On Win32: bin\shutdown
The shutdown process incorporates a host, port, and a password. In the default configuration, the host defaults to localhost.
This means that Tomcat can only be shutdown from the same computer that started it. The port automatically defaults to the port being used by the Ajp12 protocol. The password defaults to "not specified". This means that a password will not be required to shutdown Tomcat:
Developed Software
Some frequently occurred problems and their solutions are given below
Ql. Tomcat cannot be started, what can be done?
Ans. Oracle's TNSListener should be stopped, Tomcat should be started (TNSListener should be started again).
Q2. Required html pages can not be found, what can be done?
Ans. Stepl> Given URL should be checked, if URL is ok step 2 should be followed else it must be fixed.
Step2> With http://Iocalhost:8080/ uri, if Tomcat's starting page comes, Step 4 should be followed else Step 3.
Step3> If Tomcat is not running, Starting Tomcat Section in the appendix section can be seen.
Step4> Web folder, context mapping and servlet registration should be checked for errors.
Q3. Invalid argument call error has shown, what should be done?
Ans. This problem can be solved by filling imperative text boxes.
Q4.How network adapter connection problem can be solved?
Ans. Oracle TnsListener should be started.
Q5. How connection refusal problem can be solved?
Ans. Database should be mounted and opened ..
37
Q6. Invalid username and password error, how to eliminate?
Ans. Spelling should be checked, if it doesn't work database administrator should be consulted.
Q7. Deletion of any data without giving Student ID or Question Number is possible, why?
Ans. No actual row will be deleted from the tables.
Q8. Data can not be inserted or modified, why?
Ans. All mandatory text boxes needed to be filled.
Q9. While there are question in tables it shows no question is available, how to solve?
Ans. Due to connection problem it may happen, moving one pages back and then returning will solve the problem
Ql0. How number of questions per pages can be changed after starting the examination
Ans. Once examination is started this option can not be changed.
Ql1. Table's can not be created, why?
Ans. Old tables with the same name should be deleted (All old information will be erased)
Q12. What will happen, if database objects are created in different schemas.
Ans. Username and password used in Module - 4 Source Codes should be changed. Otherwise students will not be able to connect.
Module 1
Codes necessary for creating database tables.
table.html
<HTML>
<HEAD>
<TITLE >LOGIN </TITLE> </HEAD >
< BODY>< FORMACTION= http://localhost :SOSO/Sohebl/servlet/ AuthenCheck METHOD=POST>
<H3>Please enter login name and identification number.</H3><BR>
<PRE>
Name: <INPUT TYPE=text NAME=Name>
ID: <INPUT TYPE=text NAME=ID>
</PRE>
<INPUT TYPE=SUBMIT value=Submit>
<INPUT TYPE=reset>
</FORM>
</BODY>
</HTML>
Authencheck.java
import java.sql. *;
import javax.swing.*;
import oracle.sql. *;
import java.io. *;
import javax.servlet. *;
import javax.servlet.http. *;
import java.util.*;
import oracle.jdbc.driver. *;
import java.math.*;
//AuthenCheck will check for valid user in the database public class AuthenCheck extends HttpServlet
{
Cannection conn;
Statement stmt;
ResultSet rset;
public void init(ServletConfig config) throws ServletException {
super.init( config);
)
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException
{
int i=O,exams;
PrintWriter output;
/ /Tname for holding Teacher Name and Tid for holding Teacher ID String Tname='''',Tid='''';
Tname= req.getPara meter("'Name");
if(Tname==null) Tname=Tname+"@";
Tid = req .getParameter("ID");
if(Tid==null) Tid=Tid+"@";
String stl,st2;
boolean identification=false;
try {
DriverManager. registerDriver (new oracle.jdbc.driver.OracleDriverO);
conn =
DriverManager.getConnection ("jdbc: oracle :thin:@netvista103: 1521: soh9i 1",Tname, Tid);
stmt = conn.createStatement
0;
rset = stmt.executeQuery ("select D.
*
from dual D");identification =true;
}
catch(Exception sqlex) {
output= res.getWriter();
res.setContentType( "text/html");
output.println(" <H2 >Check following errors</H2>");
output. println (sqlex);
output.closeO;
}
if (identification) {
Cookie c1=new Cookie("Tname",Tname);
c1.setMaxAge( -10);
Cookie c2=new Cookie("Tid",Tid);
c2.setMaxAge( -10);
res.addCookie(c1) ; res.addCookie(c2) ; output= res.getWriterO;
res.setContentType( "text/html");
String Buffer buf=new StringBuffer();
buf.append(" < HTML>< HEAD><TITLE>");
buf.append("Table Creation Page");
buf.append (" </TITLE> </HEAD> < BODY>");
buf.append(" < FORMACTION= http://netvista 103: 8080/Sohebl/servlet/CreateTable METHOD=POST>");
buf.append("<BR>"+"<H3>Please Enter Course ID (String)</H3>");
buf.append("<INPUT TYPE=text NAME=courseid>"+"<BR>");
buf.append("<BR>"+"<H3>Please Enter Number of Examinations(Integer)</H3>");
buf.append(" <INPUT TYPE=text NAME=examno>"+" <BR><BR>");
buf.append(" <INPUT TYPE=Submit Vaiue=Submit>"+"<BR>");
buf.append(" </FORM> </BODY> </HTM L>");
output. println( buf.toString());
output.c1ose() ; }
}
public void destroy() {
try {
conn .close();
}catch(Exception e) {System.err.println("Problem closing the database");}
} }
CreateTable.java
import java.sql. *;
import javax.swing. *;
import oracle.sql.*;
import java.io. *;
import javax.servlet. *;
import javax.servlet.http. *;
import java.util. *;
import oracle.jdbc.driver. *;
import java.math. *;
//CreateTable will creates necessary tables in the database under teacher schema public class CreateTable extends HttpServlet
{
Connection conn;
Statement stmt;
ResultSet rset;
public void init(ServletConfig config) throws ServletException {
super.init( config);
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException
{
PrintWriter output;
Cookie cookies[]=null;
cookies= req .getCookies();
/ / Retrieving Teacher Name and ID from cookies
String Tna me= "" ,Tid = "" ,course= null,examno_string =null;
int examno=O,exam=O;
course= req .getParameter("courseid");
examno_string = req .getParameter("examno");
if (cookies' =null) {
for (int i=O;i<cookies.length;i++) {
Cookie cookie = null;
cookie=cookies[i] ;
if( (cookie.getName()) .equals("Tname")) Tname=cookie.getValue();
if( (cookie.getName()) .equals("Tid")) Tid =cookie.getValue();
} } try {
examno= Integer. parseInt( examno_string);
}catch(NumberFormatException e) {
output= res.getWriter();
outpuLprintin("<H2 >Check following errors soheb</H2>");
output. println( e);
res.setContentType("text/html") ; String Buffer buf= new StringBuffer();
buf.a ppend(" < HTML> < HEAD> <TITLE>");
buf.append("Table Creation Page");
buf.a ppend(" </TITLE> </HEAD> < BODY>");
buf.append(" < FORMACTION= http://netvista 103 :8080/Soheb l/servlet/ AuthenCheck METHOD=POST>");
buf.append("<INPUT TYPE=HIDDEN NAME=ID VALUE="+ Tid+" >");
buf.append("<INPUT TYPE=HIDDEN NAME=Name VALUE="+ Tname+">");
buf.append(" <BR><INPUT TYPE=Submit Value= Back>"+"<BR>");
buf.append("' </FORM ></BODY> </HTML>");
output. println( buf. toString(»;
output.close() ; }
try {
DriverManager .reg isterDriver(new oracle.jdbc.d river.OracleDriver(»;
conn =
DriverManager.getConnection("jdbc: oracle :thin:@netvistal03: 1521 :soh9i 1", Tname, Tid);
stmt = conn.createStatement ();
I I Creating Teacher Table rset = stmt.executeQuery
("CREATE TABLE Teacher(ID VARCHAR2(15) CONSTRAINT Teacher_Prim PRIMARY KEY,Exams NUMBER(4) )");
rseLclose() ;stmLclose();
stmt = conn.createStatement ();
II Inserting Course Name and No. of Examinations in the Teacher Table rset = stmLexecuteQuery("INSERT INTO Teacher
VALUES(''' +course+ '" ," +examno+")");
rset.close() ;stmt.close();
stmt = conn .createStatement();
rset = stmt.executeQuery ("'Select T.
*
from Teacher T");while (rset.next()) {
exam=rset.getlnt(2) ; }
rset.close() ;stmt.close();
stmt = conn.createStatement();
IICreating Examl, Exam2, ,Examn Tables
for (int i=O;i<exam;i++) {
String name="Exam";
name=name+(i+ 1);
rset = stmt.executeQuery
("CREATE TABLE "+name+" (No Number(4) CONSTRAINT Unique_Number"+i+"
UNIQUE CONSTRAINT NotNull_Number"+i+" NOT Null,Quest VARCHAR2(200),Ansl VARCHAR2( 50) ,Ans2 VARCHAR2( 50) ,Ans3 VARCHAR2( 50) ,Ans4
VARCHAR2(50),Correct VARCHAR2(5»)");
}
rset.c1ose() ;stmLclose();
stmt = conn.createStatement();
rset = stmLexecuteQuery ("Select T.
*
from Teacher T");while (rset.next()) {
exam=rset.getlnt(2) ; }
rset.c1ose() ;stmt.close();
stmt = conn.createStatement();
((Creating Student Table rset = stmt.executeQuery
("CREATETABLE Student(ID VARCHAR2(15) CONSTRAINT Student]rim PRIMARY KEY,Name VARCHAR2(30) CONSTRAINTStudenCName NOT NULL)");
rset.close() ;stmLclose();
stmt = conn.createStatement();
for (int i=O;i<exam;i++) {
String name="Exam";
name=name+ (i+ 1);
rset = stmt.executeQuery
("ALTER TABLE Student ADD ("+name+" NUMBER(4))");
}
conn.c1ose() ;
output= res.getWriter();
res.setContentType("text(html") ;
output. println(" <H2> Tables Created«H2 >");
outpuLclose() ;
}catch(Exception sqlex) {
output= res.getWriter();
output.println(" <H2 >Check following errors«H2 >");
output. println(sqlex);
res.setContentType("text(html") ; String Buffer buf=new StringBuffer();
buf.append (" <HTML> < HEAD> <TITLE>");
buf.append("Table Creation Page");
buf.append(" «TITLE> «HEAD> < BODY>");
buf.append(" < FORMACTION= http:((netvista103:8080(Sohebl(servlet(AuthenCheck METHOD=POST>");
buf.append("<INPUT TYPE=HIDDEN NAME=ID VALUE="+ Tid+">");
buf.append("<INPUT TYPE=HIDDEN NAME=Name VALUE="+Tname+">");
buf.append(" <BR><INPUT TYPE=Submit Value=Back>"+"<BR>");
buf.a ppend(" </FORM > </BODY> </HTML>");
output. println( buf.toString(»;
output.close() ; }
}
public void destroy() {
try {
conn .close();
}catch(Exception e) {System.err.println("Problem closing the database");}
} }
7
Module 2
Codes necessary for inserting and manipulating students information in Student table
student.html
<HTMl>
<HEAD>
<TITLE >lOGIN </TiTlE > </H EAD>
< BODY><FORM ACTION= http://localhost: 8080/Sohebl/servlet/ AuthenCheckl METHOD=POST>
<H3>Please enter login name and identification number.</H3><BR>
<PRE>
Name: <INPUT TYPE=text NAME=Name>
ID: <INPUT TYPE=text NAME=ID>
</PRE>
<INPUT TYPE=SUBMIT value=Submit>
<INPUT TYPE=reset>
</FORM>
</BODY>
</HTMl>
AuthenChecklJava
import java.sql. *;
import javax.swing. *;
import oracle.sql. *;
import java.io. *;
import javax.servlet. *;
import javax.servlet.http. *;
import java.util.*;
import oracle.jdbc.driver. *;
/ / AuthenCheckl will check for valid user in the database public class AuthenCheckl extends HttpServlet
{
Connection conn;
Statement stmt;
ResultSet rset;
public void init(ServletConfig config) throws ServletException
{
super. init( config);
conn=null;
stmt=null;
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException
{
int i=O,exams;
PrintWriter output;
/ /Tname for holding Teacher Name and Tid for holding Teacher ID String Tname="",Tid="";
Tname= req .getParameter(" Name");
if(Tname==null) Tname=Tname+"@";
Tid = req .getParameter("ID");
if(Tid==null) Tid=Tid+"@";
String stl,st2;
booiean identification=false;
try {
DriverManager. registerDriver (new oracle.jdbc.driver.OracleDriver();
conn =
DriverManager.getConnection("jdbc:oracle :thin:@netvista103: 1521: soh9i 1",Tname, Tid);
stmt = conn.createStatement
0;
rset = stmt.executeQuery ("select D.
*
from dual D");identification =true;
}catch(Exception sqlex) {
output= res.getWriter();
res.setContentType("text/html") ;
output.println("<H2>Check following errors</H2>");
output. println(sqlex);
output.close() ; }
if (identification) {
Cookie c1=new Cookie("Tname",Tname);
c1.setMaxAge( -10);
Cookie c2=new Cookie("Tid",Tid);
c2.setMaxAge( -10);
res.addCookie(c1) ;
9
res.addCookie(c2) ; output= res.getWriter();
res.setcontentType("text/html") ; String Buffer buf=new StringBuffer();
buf.append(" < HTML>< HEAD><TITLE>");
buf.append("Table Creation page");
buf.append(" </TlTLE> </HEAD> < BODY>");
buf.append(" < FORMACTION= http://netvista 103: BOBo/soheb1/servlet/StudentData METHOD=POST>");
buf.append(" < BR>" +" < H3> Please Enter Student Name (String) </H3 >");
buf.append("<INPUT TYPE=text NAME=stdname size=30>"+"<BR>");
buf.append("<BR>"+"<H3>Please Enter Student 10 (String - Primary Key)</H3>");
buf.append("<INPUT TYPE=text NAME=stdid size=15>"+"<BR><BR>");
buf.append("<BR>"+"<H2>For Deletion only Student 10 Required</H2><BR>");
buf.append("<INPUT TYPE=Submit name=Student Value=Enter>");
buf.append("<INPUT TYPE=Submit name=Student Value=Delete>");
buf.append("<INPUT TYPE=Submit name=Student value=AIIStudents>");
buf.append("<INPUT TYPE=Submit name=Student value=Exit>");
buf.append(" </FORM> </BODY > </HTML>");
output.println(buf.toString()) ; outPut.c1ose() ;
} }
public void destroy() {
try {
conn.c1ose();
}catch(Exception e) {system.err.println("problem closing the database");}
} }
StudentData.java
import java.sql.*;
import javax.swing.*;
import oracle.sql. *;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http. *;
import java.util.*;
import oracle.jdbc.driver.*;
II
IIStudent Data to insert, update student information public class StudentData extends HttpServlet
{
Connection conn; Statement stmt; ResultSet rset;
public void init(ServletConfig config) throws ServietException {
super.i nit( config);
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException
{
PrintWriter output;
Cookie cookies[]=null;
cookies= req .getCookies();
II stdid= Student ID, stdname= Student Name, surf= holds option String Tname= "" ,Tid = "" ,stdid =null ,stdname= null,surf="";
int examno=O,exam=O;
stdid = req.getParameter("stdid");
stdname= req .getParameter("std name");
if (cookiesl =null) {
for (int i=O;i<cookies.length;i++) {
Cookie cookie = null;
cookie=cookies[i] ;
if( (cookie.getName()) .equals("Tname")) Tna me=cookie.getValue();
if( (cookie.getName()) .equals("Tid")) Tid =cookie.getValue();
} } try {
DriverManager. registerDriver( new oracle .jd bed river. OracieDriver()) ; conn =
DriverManager.getConnection("jdbc: oracle: thin:@netvista103: 1521: soh9i 1",Tname, Tid);
stmt = conn.createStatement();
rset = stmt.executeQuery("SELECT T* FROMTEACHERT");
rset.next() ;
exa mno= rset.getlnt("Exams");
rseLclose() ;stmt.close();
}catch(Exception sqlex){}
if( req .getParameter("Student") .equa Is(" Enter")) surf= "Enter";
if( req .getParameter("Student") .equals("Delete"» surf="Delete";
if( req .getParameter("Student") .equals(" AIIStudents"» surf="AIiStudents";
if( req .getParameter("Student") .equals("Exit"» surf="Exit";
if (surf.equals("Exit"»
{
I ITo
exitoutput= res.getWriter();
res.setContentType("text/html") ; String Buffer buf=new StringBuffer();
buf.append(" < HTML> < HEAD><TITLE>");
buf.append(" </TITLE > </HEAD > < BODY>");
buf.append(" <FORM
ACTION=http://netvista 103: 8080/Sohebl/servieti AuthenCheckl METHOD=POST>");
buf.append("<H3>Please enter login name and identification number. </H3 > < BR>");
buf.append("Name: "+"<INPUT TYPE=text NAME=Name><BR>");
buf.append("ID:"+" <INPUT TYPE=text NAME=ID><BR>");
buf.append("<INPUT TYPE=Submit Value=Submit>");
buf.append("<INPUT TYPE=Reset>");
buf.append(" </FORM > </BODY> </HTML>");
output. println(buf.toString (»;
output.c1ose() ; }
if (surf.equals("Enter")) {
I I For insertion new student try
{
stmt = conn.createStatement();
rset = stmt.executeQuery("INSERT INTO Student(ID,Name) VALUES('''+stdid+ ,n, '"+std name+,n)");
rset.close() ;stmt.close();
stmt = conn.createStatement();
rset = stmt.executeQuery("COMMIT");
output= res.getWriter();
output. println (" <H2 > Inserted SuccessfullY</H2 >");
res .setContentType( "text/html");
String Buffer buf= new String Buffer();
buf.a ppend(" < HTML>< HEAD> <TITLE> ");
buf.append("Insertion Creation Page");
buf.a ppend(" </TITLE> </HEAD> < BODY>");
buf.append("<FORM
ACTION= http://netvista 103: SOSO/soheb1/ servlet/ AuthenCheck 1 METHOD=POsT>");
buf.append("<INPUT 1YPE=HIDDEN NAME=ID VALUE="+ Tid+">");
buf.append("<INPUT 1YPE=HIDDEN NAME=Name VALUE="+ Tname+">");
buf.append("<BR> <INPUT 1YPE=submit Value=More>"+"<BR>");
buf.append(" </FORM > </BODY> </HTML>");
output. println( buf.tostring());
outpuLclose() ;
rseLclose() ;stmt.close();
}catch(Exception sqlex) {
output= res.getWriter();
output.println(" <H2>Check following errors soheb</H2 >");
output. println (sqlex);
res.setContentType("text/html") ; stringBuffer buf= new stringBuffer();
buf.append(" < HTML> < HEAD> <TITLE>");
buf.append("Table Creation Page");
buf.append(" </TITLE> </HEAD > < BODY>");
buf.append("<FORM
ACTION= http://netvista 103: SOSO/soheb l/servlet/ AuthenCheck 1 METHOD=POsT>");
buf.append("<INPUT 1YPE=HIDDEN NAME=ID VALUE="+ Tid+">");
buf.append("<INPUT 1YPE=HIDDEN NAME=Name VALUE="+ Tname+">");
buf.append(" <BR><INPUT 1YPE=submit Value= Back>"+"<BR>");
buf.append(" </FORM > </BODY > </HTML>");
output. println (buf. tostring());
outpuLclose() ; }
}
if (surf.equals("Delete")) {
/ / For deleting student's information try
{
output= res.getWriter();
res.setContentType("text/html") ; String Buffer buf=new stringBuffer();
buf.a ppend(" < HTML>< HEAD><TITLE >");
buf.append("Deletion Creation Page");
buf.append(" </TITLE > </HEAD > < BODY>");
13
buf.a ppend(" < FORMACTION= http://netvista 103: 8080/soheb 1/servlet/DeleteRecord METHOD=POsT>");
buf.append (" <INPUT TYPE=radio NAME=ExamName VALUE=AIl>" + "All" +" < BR>");
for(int j=O;j<examno;j++) {
buf.append("<INPUT TYPE=radio NAME=ExamName VALUE=Exam"+(j+ 1)+"
CHECKED>"+"Examination"+(j+ 1)+" <BR>");
}
buf.append("<INPUT TYPE=HIDDEN NAME=ID VALUE="+Tid+">");
buf.append("<INPUT TYPE=HIDDEN NAME=Name VALUE="+ Tname+">");
buf.append("<INPUT TYPE=HIDDEN NAME=stdid VALUE="+stdid+">");
buf.append("<BR><INPUT TYPE=submit Value=Done>"+"<BR>");
buf.append(" </FORM ></BODY> </HTM L>");
output. println( buf.tostring 0);
output.closeO;
}catch(Exception sqlex) {
output= res.getWriterO;
output.println("<H2>Check following errors</H2>");
output. println(sqlex);
res.setContentType("text/html") ; String Buffer buf=new stringBufferO;
buf.a ppend(" < HTML>< HEAD> <TITLE>");
buf.append("Table Creation Page");
buf.append(" </TITLE> </HEAD> < BODY>");
buf.append(" <FORM
ACTION=http://netvista 103: 8080/sohebl/servletl AuthenCheck 1 METHOD=POsT>");
buf.append("<INPUT TYPE=HIDDEN NAME=ID VALUE="+Tid+">");
buf.append("<INPUT TYPE=HIDDEN NAME=Name VALUE="+ Tname+">");
buf.append("<BR><INPUT TYPE=submit Value=Back>"+"<BR>");
buf.a ppend(" </FORM ></BODY> </HTM L>");
output. println (buf.tostring());
output.close() ; }
}
if (surf.equals("Alistudents")) {
liTo
see all student try{
stmt = conn.createstatement();