You are on page 1of 146

DECLARATION

This is to certify that Report entitled E-LEARNING. which is


submitted by us in partial fulfillment of the requirement for the
award of degree B.Tech. in Information Technology to YOUR
COLLEGE NAME, YOUR UNIVERSITY NAME,CITY NAME comprises
only our own work and due acknowledgement has been made in the
text to all other material used.
Date: DD.MM.YYYY Your Name(Your Regn No)


Certificate

This is to certify that Report entitled E-LEARNING which is submitted by YOUR NAME in
partial fulfillment of the requirement for the award of degree B.Tech. in Information Technology
to YOUR COLLEGE NAME,PLACE,YOUR UNIVERSITGY NAME,PLACE is a record of the
candidates own work carried out by him/her under my/our supervision. The matter embodied in
this thesis is original and has not been submitted for the award of any other degree.


Date: DD/MM/YYYY


Supervisor
Name of the Guide
Signature

ACKNOWLEDGEMENT

We take this opportunity to express our profound sense of gratitude and respect to
all those who helped us throughout the duration of this project.
Firstly, we are extremely grateful to your college name, for providing us the
excellent working environment to undergo our project.
We devote our success in this effort to our project guide your guide name for giving
us the opportunity to undertake the project and providing crucial feedbacks that
influenced us and provided opportunity to undertake the project work in the
esteemed concern.
We are also deeply thankful to professor Name with Deptt
Name whose useful suggestions, gentle and
soothing attitude and right directions helped us a lot to learn in this project and also
for his constant encouragement and support throughout the project
Last, but not the least, we would like to extend our profound thanks to all our
esteemed colleagues and friends at college level who helped us in the specific areas
of this project.

Your name

Table of Contents
S. No.
Topics
Page Number
01 Declaration 2
02 Certificate 3
03 Acknowledgement 4
04 Introduction
(i) About the project
(ii) Purpose of the project
(iii) Understanding of existing system
(iv) Tools / Environment used
7
7
8
8
05 System Development Life Cycle 9
06 Requirement analysis phase
(i) Feasibility study
11
07 System Design
(i) ER Diagram
(ii) Class Diagram
(iii) Table Structure
13
14
17
08 Coding
(i) Front End
(ii) Back End
21
102
09 Testing 123
10 Screen Snap Shots
(i) Main Screens
(ii) Forms
(iii) Reports
125
128
135
11 Conclusion 141
12 Limitations 142
13 Further Enhancement 143
14 References / Bibliography 144


4. INTRODUCTION
4.1 About the project
E-learning is another form of distance learning where education and training courses are
delivered using computer technology. Typically, this means that courses are delivered either via
the Internet, or on computer networks (linked computers). With the increased availability of PCs
and Internet access, e-learning is becoming more and more popular.
E-Learning is a web application uses JSP. The database is Oracle 10g. This online application
enables the end users to register online, select the subject, read the tutorial and appear for the
exam online. The results of the exams are also declared just after taking the test. The minimum
pass percentage is 50%. A person is given three attempts to pass a paper. In subjects containing
more than one exam, the candidate should take tests in a particular sequence and also he can
attempt the next test only if he has completed the previous papers. The correct answers for the
questions are displayed after the exam. The date of the registration, date of exam, number of
attempts, test result etc. are stored in the database.
4.2 Purpose of the project

Education through the internet, network and a computer is E-learning. This helps in network
enabled transfer of skills and knowledge. E-learning refers to use of electronic applications and
processes to learn. This is a web based application which can be hosted in the website of any
training institute. The students will be able to register online, read the course material and write
online exam. Certificates also will be issued online.
The objectives of this project are
To provide distance learning
To make it convenient for people who have other commitments
Cost reduction
Reduced paper work
Computer evaluated tests

4.3 Understanding of existing system
Shows educators and trainers how to adapt teaching methods and materials to make use of the
Internet. Including a framework showing how to apply Internet technology progressively as
skills and confidence grow, the project demonstrates the route from adapting materials to
developing a virtual course.
Nowadays, when people are not having time to visit an institute. Therefore, the software is
designed to provide the education through Internet. The project E LEARNING helps the
common world in any field they are to get the knowledge what they want even sitting at there
places. This helps them to spare time in their busy schedule and save their time during
transportation.
4.4 Tools/Environment Used
HARDWARE REQUIREMENTS

Processor : Pentium III/IV (Preferably P-IV)
RAM: 256 MB
SOFTWARE REQUIREMENTS
Web Server: Apache Tomcat Server
0perating System: Windows ME/2000/XP/UNIX
Language: JSP(JAVA Server Pages), HTML
Database : Oracle 10g


5. System Development Life Cycle


The methodology used for developing this system is PROTOTYPING MODEL. This
model is used here because detailed input, output requirements are not present in the
beginning, and thus it is felt that a prototyping model will be more suitable for
development. In this model, we will create a quick design and then invite user to test the
developed system and refine requirements if any. Thus, the process for development
will be iterative.
Often, a customer defines a set of general objectives for software but does not identify
detailed input, processing or output requirements. In other cases, the developer may be
unsure of the efficiency of an algorithm, the adaptability of an operating system, or the
form that human/machine interaction should take. In these, and many other situations, a
prototyping model offers the best approach.
It generally has the following steps:
i. Requirement Gathering
ii. Quick Design
iii. Build Prototype
iv. Customer Evaluation
v. Review/Modify Requirements
vi. Coding
vii. Testing


6. Requirement Analysis Phase
6.1 Feasibility study

This part or aspect of systems analysis that concentrates on finding out whether an intended
course of action violates any constraints is referred to as FEASIBILITY analysis .All the projects
are feasible given unlimited resources and infinite time! Unfortunately, the development of a
computer based system or product is more likely beleaguered by scarcity of evaluate the
feasibility of a project at the earliest possible time of project inception.

Technical Feasibility-:
Technical feasibility centers on the existing computer system (hardware,software,etc.) and on the
extent it can support the proposed addition . Financial considerations have to be taken into
account for technical enhancements. In short the study of function, performance, and constraints
that may affect the ability to achieve an acceptable system. If the budget is a serious constraint,
then the project is judge not feasible .This project is considered technically feasible for
development.

Economical Feasibility-:
Economic analysis is the most frequently used method for evaluation the effectiveness of a
candidate system. More commonly known as cost/benefit analysis, the procedure is to determine
the benefits and savings that are expected from candidate system and compare them with costs. If
benefits outweigh costs then the decision.
Operational Feasibility-:
Operational Feasibility is reviewed in the early stages of project planning . Proposed project is
beneficial only if it can be turned into information systems that will meet the organizations
operational requirement. In the operational feasibility it is checked if the system will work, when
it is developed and deployed which are major barriers to the development a consideration about
the working of the system after installation in the organization.
The software, which is developed , has an interactive, user-friendly interface, so operational
difficulties are almost eliminated. It will improve the performance after implementation as the
information can be delivered to the destination with utmost security. Hence the project is
considered operationally feasible.


7.1 ER-Diagram
7.2 Class Diagram

7.3 Table Structure
Results
Field Name Data Type
course_id Number
trainee_id Text
Marks Number
qn1 Number
qn2 Number
qn2 Number
ans1 Number
ans2 Number
ans3 Number
paper_id Number
Attempt_id Number
Result Number
x_masterListOfCategory
Field Name Data Type
Course_category_id Number
Course_category Text
x_masterListOfCourses
Field Name Data Type
Course_id Number
Course_category_id Number
Course_name Text
Course_description Text
No_of_papers Number
x_masterListOfPapers
Field Name Data Type
Paper_id Number
Paper_no Number
Paper_name Text
Course_id Number
Paper_description Text
x_masterListOfDocuments
Field Name Data Type
Document_id Number
Paper_id Number
Paper_no Number
Document_name Text
Document_filename Text
Document_description Text
_masterListOfQuestions
Field Name Data Type
Paper_id Number
Question_id Number
Question Text
Choice1 Text
Choice2 Text
Choice3 Text
Choice4 Text
Ans Number
_master_elearning_user
Field Name Data Type
User_name Text
Pass_word Text
First_name Text
Designation Text
Email Text
City Text
Country Text
_master_trainee_detail_online
Field Name Data Type
Trainee_id Number
Is_regiteres Number
Is_attended_exam Number
Is_successfully_completed Number
Course_completed_date Date
Total_marks Number
Doe Date
User_name Text
Course_id Number
Paper1_no_of_attempts Number
Paper2_no_of_attempts Number
Paper3_no_of_attempts Number
Paper1_marks Number
Paper2_marks Number
Paper3_marks Number
Paper1_completed_date Date
Paper2_completed_date Date
Paper3_completed_date Date
Paper_id1 Number
Paper_id2 Number
Paper_id3 Number
Is_paper1_completed Number
Is_paper2_completed Number
Is_paper3_completed Number
Paper1_appeared_on Date
Paper2_appeared_on Date
Paper3_appeared_on Date
Is_paper1_tutorial_viewed Number
Is_paper2_tutorial_viewed Number
Is_paper3_tutorial_viewed Number
No_of_papers Number


9. Testing
TestPlan:-This document describes the plan for testing E-Learning Software. All the
major testing strategies are specified here; additional testing may be scheduled later, if
necessary.
1.Test Units
In this project we will perform two levels of testing: Unit testing & System testing.
Because the System is moderate in Size, it is felt that there is no need for elaborate
integration testing. The basic units to be tested are:
# Modules to Tables
# Tables to Reports
# Other Units
In addition, some other units may be chosen for testing. The testing for these different
units will be done independently.
2.Features To Be Tested
All the functional features specified in the requirement document will be tested. No
testing will be done for the performance, as the response time requirement is quite
weak.
3.Approach To Testing
For Unit Testing, Structural Testing based on the branch coverage criterion will be used.
The goal is to achieve branch coverage of more than 95%. System testing will be
largely functional in nature. The focus is on Invalid and Valid cases, Boundary Value
and Special Cases.
4.Test Deliverables
The following documents are required (besides this Test Plan):
Unit test report of each Unit.
Test case Specification for System Testing
Test Report for System Testing
Error Report
The test case specification for System Testing has to be submitted for review before
System Testing Commences.
5.Schedule
The entire testing- Unit & System will be finished within the month of December. Test
case Specifications for the System Testing will be produced while Unit Testing is going
on. This Schedule is consistent with the over all schedule of the project. The schedule
for the testing is shown in the Project Planning section.
Test Case Specification for System Testing
Here we specify all the test cases that are used for System Testing. First, the different
conditions that need to be tested, along with the test cases for testing those condition
and the expected output are given. Then the data files used for testing are given. The
Test cases are specified with respect to these data files. The Test cases have been
selected using functional approach. The goal is to test the different functional
requirements, as specified in the requirement document. Test cases have been
selected for both Valid as well as Invalid Input.

List of Screenshots:
Shot 1 : Participant Login Page
Shot 2 : List of Subjects
Shot 3 : Enrollment of Participant
Shot 4: SignUp
Shot 5 : Change Password
Shot 6 : List of Study Materials
Shot 7 : Exam Status
Shot 8 : Exam Instructions
Shot 9 : Exam Question Display
Shot 10 : Exam Question Display (continued)
Shot 11 : Result
Shot 12 : Result (continued)
Shot 13 : Exam Status
Shot 14 : Exam Status(continued)
Shot 15 : User Menu
Shot 16 : Profile



11. Conclusion
We have successfully designed and developed a project on E
Learning. Working on the project was good experience. This project
is designed for Online Education. This project is designed in
JSP(Java Server Pages) which runs on Apache Tomcat Web Server.
Keeping in view these facts we have developed successfully.
Developing the project has helped us some experience on website
development.


12. Limitations
Some of the Liminations of this project are
The questions have to be written to the database directly
There is no facility for multiple choice questions
There is no facility for subjective answers
There is no chat facility which allows the student to interact with
the lecturer directly


13. Further enhancements
Further enhancements to this project will be to create a module for entering the questions to the
database. As of now, the questions are directly written into tables by the administrator . Creating a
computerized module for it may help entry without mistakes.
Another enhancement would be to allow multiple choice questions and subjective questions.This would
allow many varieties of questions to be added. The tutorials can be made available in flash format and
other animated formats.


14. References
1.JAVAServer Pages
By: SAMS ,Techmedia.
2.Javascript
By: Ivan Bayross
3.HTML Complete
By: Sybex Authors
4.Dynamic HTML
By: Joseph Schmuller
5.System Analysis & Design
By: Ilias M Awad
6.Software Engineering A Practitioners Approach
By: Roger S Pressman
7.Oracle 9i The Complete Reference
By: LONEY KOCH




A complete JAVA(JSP) Project for
Engineering Students
A complete JAVA(JSP) Project on ELEARNING for Engineering College Students.This
page Contains complete coding,screenshots,E-R Diagrams,Data Flow Diagrams and
the complete documentation. It gives the idea for how to prepare documentation for
a college project and makes the work of documentation very easy.
TOPIC-8-CODING (Elearning Project)
8. Coding

course_list_index2.jsp
<%@ page language="java"%>
<html>
<head>
<title>E-LEARNING</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.activeMenu{
font-family:verdana;font-weight:bold;font-size:11px;color:#666666;text-decoration:none;
}
A.menuLink{
font-family:verdana;font-size:11px;color:#666666;text-decoration:none;
}
A.menuLink:hover{
font-family:verdana;font-size:11px;color:#666666;text-decoration:none;
}
TD.infoLabel{
font-family:verdana;font-size:11px;color:#666666;text-decoration:none;
}
TD.infoValue{
font-family:verdana;font-weight:bold;font-size:11px;color:#336699;text-decoration:none;
}
TD.login{
font-family:verdana;font-size:11px;color:#111111;text-decoration:none;
}
</style>
<script>
function fnValidate()
{
if(document.f1.user_name.value==""){
alert("Enter your user name.");
return false;
}
if(document.f1.pass_word.value==""){
alert("Enter your Password.");
return false;
}
}
</script>
</head>
<body background="bg.jpg" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <td></td> <td height="100">&nbsp; </td> </tr>
</table>
<table width="100%" border="0">
<tr>
<td>
<!--start of result display-->
<table width="100%" align="center">
<tr> <td>
<%
if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate">
<strong><font color="#FFffff" size="2" face="Arial">
<%=request.getParameter("result")%>
</font></strong></marquee>
<%
}
%>
</td> </tr> </table>
<!--end of result display-->
<br>
<br>
<form name=f1 action="user_login_verification.jsp" method=post >
<table width="50%" border="0" align="right" cellpadding="0" cellspacing="2">
<tr>
<td rowspan="5">&nbsp;</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td height="25" colspan="2" align="center"><div align="left">
<font color="#666666" size="2" face="Arial"><strong>Login
by Participant</strong></font></div></td>
</tr>
<tr>
<td width="25%" class="infoLabel">&nbsp;&nbsp;User ID:</td>
<td width="75%"><font color="#999999">
<input type="text" name="user_name" >
</font></td>
</tr>
<tr>
<td class="infoLabel">&nbsp;&nbsp;Password:</td>
<td> <input type="password" name="pass_word"> </td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name=submit value=Login onClick="return fnValidate()"></td>
</tr>
<tr>
<Td colspan=2>&nbsp;</Td>
</tr>
<tr>
<Td colspan=2>&nbsp;</Td>
</tr>
<tr>
<td>&nbsp;</td>
<Td colspan=2><div align="left"><font size="2" face="Arial, Helvetica, sans-serif">
<a href="forgot_password.jsp"><font color="#FF0000">Forgot Password? </font></a></font><font
size="2">&nbsp;&nbsp;&nbsp;&nbsp;</font>
<font size="2" face="Arial, Helvetica, sans-serif"><a href="signup.jsp">
<font color="#FF0000">New
User?Sign up</font></a></font>
<font size="2">&nbsp;&nbsp;&nbsp;&nbsp;</font></div></Td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
------------------------------------------------------------------------------------------
signup.jsp
<%@ page import="INCLUDES.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>e-Learning</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function fnMenuBg1(elementId)
{
document.getElementById(elementId).style.backgroundColor="#dfdfdf";
}
function fnMenuBg2(elementId)
{
document.getElementById(elementId).style.backgroundColor="#ffffff";
}
function fnValidate()
{
if(document.f1.trainee_name.value==""){
alert("Enter your name.");
return false;
}
if(document.f1.email.value==""){
alert("Enter your Email Id.");
return false;
}
if(document.f1.user_name.value==""){
alert("Enter username.");
return false;
}
if(document.f1.pass_word.value==""){
alert("Enter Password");
return false;
}
if(document.f1.retype_pass.value==""){
alert("Retype Password");
return false;
}
if(document.f1.pass_word.value!=document.f1.retype_pass.value){
alert("Password did not match");
return false;
}
}
</script>
</head>
<body background="signup.jpg">
<!--start of result display-->
<table width="100%" >
<tr>
<td>
<%if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate"><strong><font color="#FF0000" size="2" face="Arial, Helvetica, sans-
serif"><%=request.getParameter("result")%></font></strong></marquee>
<%
}%>
</td>
</tr>
</table>
<!--end of result display-->
<table width="45%" border="0" align="right" cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF">
<tr>
<td>
<form name="f1" action="signup_insert.jsp" method="post">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td colspan="2" class="infoLabel"><strong>
<font color="#000099" size="2" face="Arial, Helvetica, sans-serif">
Enter Your Personal Details</font></strong></td>
</tr>
<tr>
<td class="infoLabel"><font color="#FF0000">*</font>Your Name:</td>
<td><input type="text" name="trainee_name"></td>
</tr>
<tr>
<td class="infoLabel"><font color="#FF0000">*</font>Email ID:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td class="infoLabel"> City:</td>
<td><input type="text" name="city"></td>
</tr>
<tr>
<td class="infoLabel"> Country:</td>
<td><input type="text" name="country"></td>
</tr>
<tr>
<td class="infoLabel">Designation:</td>
<td><input type="text" name="designation"></td>
</tr>
<tr>
<td class="infoLabel">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="infoLabel">
<font color="#000099" size="2" face="Arial, Helvetica, sans-serif">
<strong>Enter Your Login Details</strong></font></td>
</tr>
<tr>
<td class="infoLabel"><font color="#FF0000">*</font>User Name:</td>
<td><input type="text" name="user_name" ></td>
</tr>
<tr>
<td class="infoLabel"><font color="#FF0000">*</font>Password:</td>
<td><input type="password" name="pass_word"></td>
</tr>
<tr>
<td class="infoLabel"><font color="#FF0000">*</font>Retype Password:</td>
<td><input type="password" name="retype_pass"></td>
</tr>
<tr>
<td class="infoLabel">&nbsp;</td>
<td><input type="submit" name="submit" value="Submit" onClick="return fnValidate()" >
</table>
</form></td>
</tr>
</table>
</body>
</html>
-----------------------------------course_list1_model2.jsp-------------------------------------

<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<%
String sort_by="";
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?
result=Session Timed Out.Please, Login again.");
}
if(request.getParameter("sort_by")!=null)
{
sort_by=request.getParameter("sort_by");
}
if(sort_by.equals("category"))
{
sort_by="course_category,course_name";
}
else
{
sort_by="course_name";
}
String statement="select * from x_masterListOfCourses s,x_masterListOfCategory cat where
s.course_category_id=cat.course_category_id order by " + sort_by;
ResultSet objRs=null;
ResultSet oRsTraineeStatus=null;
try
{
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
}
catch(Exception e)
{
%>error occured : <%=e%><%
}
%>
<html>
<head>
<title>e-Learning</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function fnMenuBg1(elementId)
{
document.getElementById(elementId).style.backgroundColor="#dfdfdf";
}
function fnMenuBg2(elementId)
{
document.getElementById(elementId).style.backgroundColor="";
}
</script>
</head>
<body topmargin="0">
<table width="100%" height="200" background="bg_top.jpg">
<tr>
<td align="right" valign="top">
<table border="0" align="right" cellpadding="0" cellspacing="0" >
<tr align="center">
<td height="15" id=home><a href="course_list_index2.jsp" class="menuLink" onMouseOver="fnMenuBg1('home')"
onMouseOut="fnMenuBg2('home')">
&nbsp;&nbsp; Home&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=profile><a href="view_profile.jsp" class="menuLink" onMouseOver="fnMenuBg1('profile')"
onMouseOut="fnMenuBg2('profile')">&nbsp;&nbsp;View
Profile&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=password><a href="change_password.jsp" class="menuLink"
onMouseOver="fnMenuBg1('password')" onMouseOut="fnMenuBg2('password')">&nbsp;&nbsp;Change
Password&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td width="1" height="15" id=logout><a href="logout.jsp" class="menuLink" onMouseOver="fnMenuBg1('logout')"
onMouseOut="fnMenuBg2('logout')">&nbsp;&nbsp;Logout&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" align="right" class="login" >&nbsp;&nbsp;Login by:<%=user_name%>
</td>
</tr>
</table>
</td>
</tr></table>
<!--start of result display-->
<table width="100%" >
<tr>
<td>
<%if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate"><strong>
<font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">
<%=request.getParameter("result")%></font></strong></marquee>
<% }%>
</td>
</tr>
</table>
<!--end of result display-->
<table width="100%" height="858" >
<tr>
<td align="center" valign="top"> <table width="100%" border="1" cellpadding="0" cellspacing="0"
bordercolorlight="#FFFFFF">
<tr bgcolor="#FF9900">
<td width="4%" height="25"> <div align="center">
<font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><strong>
<font size="2">S.No</font></strong></font></div></td>
<td height="25"> <div align="center"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><strong><font
size="2">C.
Code</font></strong></font></div></td>
<td width="34%" height="25"> <div align="center">
<font color="#FFFFFF"><a href="course_list1_model2.jsp?sort_by=course" title="Click here to sort by course name">
<font face="Arial, Helvetica, sans-serif"><strong><font size="2" color="#FFFFFF">Course
Name</font></strong></font></a></font></div></td>
<td width="21%" height="25"> <div align="center">
<font color="#FFFFFF"><a href="course_list1_model2.jsp?sort_by=category" title="Click here to sort by course
name"><font face="Arial, Helvetica, sans-serif"><strong><font size="2" color="#FFFFFF">Course
Category</font></strong></font></a></font></div></td>
<td width="24%" height="25"> <div align="center">
<font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><strong>Your
Status</strong></font></div></td>
<td width="10%" height="25"> <div align="center">
<font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><strong>&nbsp;</strong></font></div></td>
</tr>
<%
try
{
int i=1;
while(objRs.next())
{
%>
<%
int course_id=objRs.getInt("course_id");
int no_of_attempts=0;
int is_successfully_completed=0;
String date_of_registration_str=null;
String course_completed_date_str=null;
java.util.Date date_of_registration=null;
java.util.Date course_completed_date=null;
int is_registered=0;
String back_color="";
try
{
String statement1="select * from x_master_trainee_detail_online where course_id=" + course_id + " and
user_name='" + session.getAttribute("user_name") + "'";
DB1.setStatement(statement1);
oRsTraineeStatus=DB1.result();
if(oRsTraineeStatus.next())
{
is_registered=oRsTraineeStatus.getInt("is_registered");
date_of_registration=oRsTraineeStatus.getDate("doe");
date_of_registration_str=date_of_registration.getDate() + "-" + (date_of_registration.getMonth()+1) + "-" +
(date_of_registration.getYear()+1900);
is_successfully_completed=oRsTraineeStatus.getInt("is_successfully_completed");
course_completed_date=oRsTraineeStatus.getDate("course_completed_date");
course_completed_date_str=course_completed_date.getDate() + "-" + (course_completed_date.getMonth()+1) + "-"
+ (course_completed_date.getYear()+1900);
}
}
catch(Exception ex)
{
}
if(is_successfully_completed==1)
{
back_color="bgcolor=#FFFFCC";
}
else
{
if(is_registered==1)
{
back_color="bgcolor=#f0f0ff";
}
else
{
back_color="";
}
}
%>
<tr <%=back_color%>>
<td height="30"> <div align="center"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-
serif"><%=i%></font></div></td>
<td height="30" ><div align="center"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-
serif"><%=course_id%></font>
</div></td>
<td height="30" title="<%=objRs.getString("course_description")%>" ><font color="#666666" size="2" face="Verdana,
Arial, Helvetica, sans-serif"><%=objRs.getString("course_name")%></font></td>
<td height="30"> <div align="left"><font color="#666666" size="2" face="Verdana, Arial, Helvetica, sans-serif"
><%=objRs.getString("course_category")%></font></div></td>
<td height="30"> <font color="#666666">
<%
if(is_successfully_completed > 0)
{%>
<font size="1" face="Arial, Helvetica, sans-serif">Successfully completed
on <%=course_completed_date_str%></font></font> <font color="#666666">
<%
}
else
{
if(is_registered==1)
{
%>
<font size="1" face="Arial, Helvetica, sans-serif"> Enrolled on <%=date_of_registration_str%><br>
(not yet completed)</font></font> <font color="#666666">
<% }
else
{%>
<font size="1" face="Arial, Helvetica, sans-serif">Not yet enrolled</font></font><font color="#666666" size="2"
face="Arial, Helvetica, sans-serif"><strong>
</strong></font> <font color="#666666">
<% }
}%>
</font></td>
<td height="30"> <div align="center"><a href="course_step.jsp?course_id=<%=course_id%>">
<font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif"><strong>
select<font color=#336699 face="Times New Roman">&#9658 </font></strong></font></a></div></td>
</tr>
<%
i=i+1;
}
}
catch(Exception e)
{
%>
Error ocuured in while : <%=e%>
<%
}
%>
</table>
<!--old----------------------------------------------->
<font color="#000099" size="2" face="Arial, Helvetica, sans-serif"><br>
<br>
</font> </td>
</tr>
</table>
<br>
</div>
</body>
</html>
------------------------------------------course_step.jsp-----------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<%
int course_id=0;
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?result=Session Timed Out.Please, Login again.");
}
String statement="";
String course_name="";
String course_category="";
String trainee_name="";
int no_of_papers=0;
String course_description="";
if(request.getParameter("course_id")!=null)
{
course_id=Integer.parseInt(request.getParameter("course_id"));
session.setAttribute("course_id",Integer.toString(course_id));
}
ResultSet objRs=null;
ResultSet oRsTraineeStatus=null;
try
{
statement="select * from x_master_elearning_user u,x_masterListOfCourses c,x_masterListOfCategory cat where
c.course_category_id=cat.course_category_id and c.course_id=" + course_id + " and u.user_name='" + user_name +
"'";
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
}
catch(Exception e)
{
%>error occured : <%=e%><%
}

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>e-Learning</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function fnMenuBg1(elementId)
{
document.getElementById(elementId).style.backgroundColor="#dfdfdf";
}
function fnMenuBg2(elementId)
{
document.getElementById(elementId).style.backgroundColor="";
}
function fnClick(getElement,course_id)
{
if(getElement=="enroll")
{
location.href="enroll.jsp?course_id=" + course_id;
}
if(getElement=="tutorial")
{
location.href="view_document.jsp?course_id=" + course_id;
}
if(getElement=="evaluate")
{
location.href="course_registration_form.jsp?course_id=" + course_id;
}
if(getElement=="exam")
{
location.href="course_tutorial1.jsp?course_id=" + course_id;
}
if(getElement=="result")
{
location.href="course_registration_form.jsp?course_id=" + course_id;
}
if(getElement=="certificate")
{
location.href="view_certificate.jsp?course_id=" + course_id;
}
if(getElement=="choose")
{
location.href="course_list1_model2.jsp";
}
}
</script>
</head>
<body background="bg_step.jpg" topmargin="0" leftmargin="0">
<%
try
{
if(objRs.next())
{
trainee_name=objRs.getString("first_name");
course_name=objRs.getString("course_name");
course_category=objRs.getString("course_category");
no_of_papers=objRs.getInt("no_of_papers");
course_description=objRs.getString("course_description");
}
}
catch(Exception e)
{
out.print("Error occured in objRs : " + e);
}
%>
<table border="0" align="right" cellpadding="0" cellspacing="0" >
<tr align="center">
<td height="15" id=home><a href="course_list1_model2.jsp" class="menuLink" onMouseOver="fnMenuBg1('home')"
onMouseOut="fnMenuBg2('home')">
&nbsp;&nbsp; Home&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=profile><a href="view_profile.jsp" class="menuLink" onMouseOver="fnMenuBg1('profile')"
onMouseOut="fnMenuBg2('profile')">&nbsp;&nbsp;View
Profile&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=password><a href="change_password.jsp" class="menuLink"
onMouseOver="fnMenuBg1('password')" onMouseOut="fnMenuBg2('password')">&nbsp;&nbsp;Change
Password&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td width="1" height="15" id=logout><a href="logout.jsp" class="menuLink" onMouseOver="fnMenuBg1('logout')"
onMouseOut="fnMenuBg2('logout')">&nbsp;&nbsp;Logout&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" align="right" class="login" >&nbsp;&nbsp;Login by:<%=user_name%>
</td>
</tr>
</table>
<table width="100%" >
<tr>
<td align="center" valign="top">
<!--start of result display-->
<table width="100%" align="center">
<tr>
<td>
<%
if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate">
<strong><font color="#FFffff" size="2" face="Arial, Helvetica, sans-
serif"><%=request.getParameter("result")%></font></strong></marquee>
<%
}
%>
</td>
</tr>
</table>
<!--end of result display-->
<%
try
{
statement="select * from x_master_trainee_detail_online where course_id=" + course_id + " and user_name='" +
session.getAttribute("user_name") + "'";
DB1.setStatement(statement);
oRsTraineeStatus=(ResultSet)DB1.result();
}
catch(Exception e)
{
%>error occured in parameters : <%=e%><%
}
int is_registered=0;
int is_successfully_completed=0;
int is_paper1_completed=0;
int is_paper1_tutorial_viewed=0;
int is_evaluated=0;
String date_of_registration="";
String course_completed_date="";
try
{
if(oRsTraineeStatus.next())
{
is_paper1_tutorial_viewed=oRsTraineeStatus.getInt("is_paper1_tutorial_viewed");
is_paper1_completed=oRsTraineeStatus.getInt("is_paper1_completed");
is_registered=oRsTraineeStatus.getInt("is_registered");
date_of_registration=oRsTraineeStatus.getString("doe");
is_successfully_completed=oRsTraineeStatus.getInt("is_successfully_completed");
course_completed_date=oRsTraineeStatus.getString("course_completed_date");
session.setAttribute("trainee_id",oRsTraineeStatus.getString("trainee_id"));
}
}
catch(Exception e)
{
out.print("exception occured in Trainee Status " + e);
}
%>
<tr><td>
<table width="50%" border="0" align="right" cellpadding="0" cellspacing="0" bordercolordark="#FF9900"
bordercolorlight="#FFCC00" bordercolor="#FF9900">
<tr>
<td bordercolor="#000000">
<table width="100%" border="0" cellpadding="5">
<tr>
<td width="50%" align="right" class="infoLabel">Your Name:</td>
<td class="infoValue"><%=trainee_name%></td>
</tr>
<tr>
<td width="50%" align="right" class="infoLabel">Course Name:</td>
<td class="infoValue"><%=course_name%></td>
</tr>
<tr>
<td width="50%" align="right" class="infoLabel">Course Category:</td>
<td class="infoValue"><%=course_category%></td>
</tr>
<tr>
<td width="50%" align="right" class="infoLabel">Total no. of Modules:</td>
<td class="infoValue"><%=no_of_papers%></td>
</tr>
<tr>
<td width="50%" align="right" class="infoLabel">Course Description:</td>
<td class="infoValue"><%=course_description%></td>
</tr>
</table></td></tr></table></td></tr>
<table width="100%">
<tr>
<td width="404" valign=top>
<!--left box for steps-->
<table width="100%" border="0" align="left" cellspacing="3">
<tr>
<td width="24%"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">step
1.</font></td>
<td width="76%">
<%if(is_registered==0)
{%>
<input style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-face:verdana;font-weight:bold"
type="button" value="Enroll for this course" name="enroll" onClick="fnClick('enroll','<%=course_id%>')">
<%
}
else
{%>
<input disabled style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-face:verdana;font-
weight:bold" type="button" value="Enroll for this course" name="enroll">
<%}%>
</td>
</tr>
<tr>
<td><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">step
2.</font></td>
<%
if(is_registered==1)
{
%>
<td><input type="button" style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-
face:verdana;font-weight:bold" value="View the study material" name="tutorial"
onClick="fnClick('tutorial','<%=course_id%>')"></td>
<%
}
else
{
%>
<td><input disabled type="button" style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-
face:verdana;font-weight:bold" value="View the study material" name="tutorial"
onClick="fnClick('tutorial','<%=course_id%>')"></td>
<%}%>
</tr>
<tr>
<td><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">step
3.</font></td>
<td>
<%if(is_registered==0 || is_paper1_tutorial_viewed==0 || is_successfully_completed==1)
{%>
<input disabled type="button" style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-
face:verdana;font-weight:bold" name="exam" value="Appear for the exam"
onClick="fnClick('exam','<%=course_id%>')">
<%
}
else
{%>
<input type="button" style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-face:verdana;font-
weight:bold" name="exam" value="Appear for the exam" onClick="fnClick('exam','<%=course_id%>')">
<%}%>
</td>
</tr>
<tr>
<td><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">step
4.</font></td>
<td>
<%if(is_paper1_completed==0 || is_registered==0)
{%>
<input disabled type="button" style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-
face:verdana;font-weight:bold" value="View Result" name=result onClick="fnClick('result','<%=course_id%>')">
<%
}
else
{%>
<input type="button" style="text-align:left;padding-left:10px;width:220px;background:#dddddd;font-face:verdana;font-
weight:bold" value="View Result" name=result onClick="location.href='view_result.jsp?course_id=<%=course_id%>'
">
<%}%>
</td>
</tr>
</table>
<!--left box ends-->
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
----------------------------------------course_tutorial1.jsp-------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<%
int course_id=0;
int is_objRs_present=0;
String statement="";
ResultSet objRs=null;
ResultSet objRsPaper=null;
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?result=Session Timed Out.Please, Login again.");
}
String trainee_name="";
String course_name="";
if(request.getParameter("course_id")!=null)
{
course_id=Integer.parseInt(request.getParameter("course_id"));
}
try
{
statement="select * from x_master_elearning_user u,x_master_trainee_detail_online t,x_masterListOfCourses
c,x_masterListOfCategory cat where c.course_id=t.course_id and t.user_name=u.user_name and
c.course_category_id=cat.course_category_id and c.course_id=" + course_id + " and u.user_name='" + user_name +
"'";
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
if(objRs.next())
{
trainee_name=objRs.getString("first_name");
course_name=objRs.getString("course_name");
is_objRs_present=1;
}
else
{
response.sendRedirect("course_list_index2.asp?result=Session Timed out");
}
session.setAttribute("trainee_id",objRs.getString("trainee_id"));
}
catch(Exception e)
{
%>error occured : <%=e%><%
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>e-Learning</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body background="exam.jpg" topmargin="0">
<table border="0" align="right" cellpadding="0" cellspacing="0" >
<tr align="center">
<td height="15" id=home><a href="course_list1_model2.jsp" class="menuLink" onMouseOver="fnMenuBg1('home')"
onMouseOut="fnMenuBg2('home')">
&nbsp;&nbsp; Home&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=back><a href="course_step.jsp?course_id=<%=course_id%>" class="menuLink"
onMouseOver="fnMenuBg1('back')" onMouseOut="fnMenuBg2('back')">
&nbsp;&nbsp; Back&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=profile><a href="view_profile.jsp" class="menuLink" onMouseOver="fnMenuBg1('profile')"
onMouseOut="fnMenuBg2('profile')">&nbsp;&nbsp;View
Profile&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=password><a href="change_password.jsp" class="menuLink"
onMouseOver="fnMenuBg1('password')" onMouseOut="fnMenuBg2('password')">&nbsp;&nbsp;Change
Password&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td width="1" height="15" id=logout><a href="logout.jsp" class="menuLink" onMouseOver="fnMenuBg1('logout')"
onMouseOut="fnMenuBg2('logout')">&nbsp;&nbsp;Logout&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" align="right" class="login" >&nbsp;&nbsp;Login by:<%=user_name%>
</td>
</tr>
</table><br>
<table width="100%">
<tr>
<td height="34" colspan="4" valign="top">&nbsp;</td>
<td align="center" valign="middle">
<p>&nbsp;</p><table border="0" align="right" cellpadding="5">
<tr>
<td align="right" class="infoLabel">Your Name:</td>
<td class="infoValue"><%=trainee_name%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Course Name:</td>
<td class="infoValue"><%=course_name%></td>
</tr>
</table> </td>
</tr>
</table>

<table width="100%" height="858" >
<tr>
<td align="center" valign="top">
<!--start of result display-->
<table width="100%" align="center">
<tr>
<td>
<%
if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate"><strong><font color="#FFffff" size="2" face="Arial, Helvetica, sans-
serif"><%=request.getParameter("result")%></font></strong></marquee>
<%
}
%>
</td>
</tr>
</table>
<!--end of result display-->
<br>
<table width="50%" border="0" align="right" cellpadding="3" cellspacing="3" bordercolorlight="#FFffff">
<%
try
{
statement="select * from x_masterListOfPapers where course_id=" + course_id;
DB1.setStatement(statement);
objRsPaper=(ResultSet)DB1.result();
}
catch(Exception e)
{
%>
error occured in paper : <%=e%>
<%
}
try
{
if(is_objRs_present==1)
{
int is_previous_paper_completed=1;
int total_marks=0;
while(objRsPaper.next())
{
int paper_no=objRsPaper.getInt("paper_no");
int no_of_attempts=0;
int attempt_id=0;
int marks=0;
java.util.Date appeared_on=null;
String back_color="";
String attempt_message="";
String paper_name=objRsPaper.getString("paper_name");
no_of_attempts=objRs.getInt("paper" + paper_no + "_no_of_attempts");
int paper_id=objRsPaper.getInt("paper_id");
String dbase=objRsPaper.getString("dbase");
int is_paper_completed=objRs.getInt("is_paper" + paper_no + "_completed");
if(paper_no==1)
{
total_marks=objRs.getInt("total_marks");
}
if(is_paper_completed==1)
{
back_color="bgcolor=#ffffcc";
}
else
{
back_color="";
}
if(is_paper_completed==1)
{
attempt_message="Successfully Completed ";
}
else
{
if(is_previous_paper_completed==0)
{
attempt_message="Not yet Eligible as you have not completed previous modules";
}
else
{
switch(no_of_attempts)
{
case 0:
attempt_id=1;
attempt_message="Not completed, You have a total of 3 attempts";
break;
case 1:
attempt_id=2;
attempt_message="Not completed,1 attempt exhausted ,you have 2 more attempts.";
break;
case 2:
attempt_id=3;
attempt_message="Not completed,2 attempts exhausted,you have 1 more attempt.";
break;
case 3:
attempt_message="All the attempts are exhausted and so you cannot complete the e ";
break;
default:
attempt_message="Not completed, and you are eligible for the exam ";
}
}
}
%>
<tr>
<td colspan="3"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
Module.<%=paper_no%> : <%=paper_name%>&nbsp; </font></strong>
<%
if(paper_no==1)
{
if(no_of_attempts<3 && is_paper_completed==0)
{%>
<a
href="course_tutorial2.jsp?attempt_id=<%=attempt_id%>&course_id=<%=course_id%>&paper_id=<%=paper_id%>
&dbase=<%=dbase%>&no_of_attempts=<%=no_of_attempts%>&paper_no=<%=paper_no%>"><strong><font
color="#FF0000" size="2" face="Arial, Helvetica, sans-serif">
Appear for the exam</font></strong></a> <font size="2">
<%
}
else
{
%>
<del><strong><font color="#ff0000" face="Arial, Helvetica, sans-serif" size="2">Appear
for the exam</font></strong></del>
<%
}
}
else
{
if(is_previous_paper_completed==1 && no_of_attempts<3 && is_paper_completed==0)
{
%>
<a
href="course_tutorial2.jsp?attempt_id=<%=attempt_id%>&course_id=<%=course_id%>&paper_id=<%=paper_id%>
&dbase=<%=dbase%>&no_of_attempts=<%=no_of_attempts%>&paper_no=<%=paper_no%>"><strong><font
color="#FF0000" face="Arial, Helvetica, sans-serif" size="2">Appear
for the exam</font></strong></a>
<%
}
else
{
%>
<del><strong><font color="#ff0000" face="Arial, Helvetica, sans-serif" size="2">Appear
for the exam</font></strong></del></font>
<%
}
}
%>
</td>
</tr>
<tr>
<td>&nbsp;</td><td colspan="2"><font color="#FFFF00" size="2" face="Verdana, Arial, Helvetica, sans-
serif"><%=attempt_message%></font></td>
</tr>
<%if(no_of_attempts>0)
{%>
<tr>
<td width="7%" class="infoLabel" >&nbsp;</td>
<td width="31%" class="infoLabel">Marks obtained :</td>
<%
marks=(objRs.getInt("paper" + paper_no + "_marks")*100)/total_marks;
%>
<td width="62%" class="infoValue"><%=marks%>%</td>
</tr>
<%
appeared_on=objRs.getDate("paper" + paper_no + "_appeared_on");
String appeared_on_str=appeared_on.getDate() + "-" + (appeared_on.getMonth()+1) + "-" +
(appeared_on.getYear()+1900);
%>
<tr>
<td>&nbsp;</td>
<td class="infoLabel">Appeared On :</td>
<td class="infoValue"><%=appeared_on_str%></td>
<%
%>
</tr>
<tr>
<td>&nbsp;</td>
<td class="infoLabel">No. of Attempts :</td>
<td class="infoValue"><%=no_of_attempts%></td>
</tr>
<%}%>
<tr>
<td colspan="3"><hr noshade color="#FFFFCC"></td>
</tr>
<%
is_previous_paper_completed=is_paper_completed;
}
%>
<tr>
<td class="infoLabel" colspan="3">Pass precentage :50%</td>
</tr>
<%
}
else
{
out.print("NIL");
}

%>
</table>
<div align="left">
</div></td>
</tr>
<%
}
catch(Exception e)
{
out.print("error occured in while of paper : " + e);
}
%>
</table>
</body>
</html>
--------------------------------------------course_tutorial2.jsp------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<html>
<head>
<title>
ELEARNING
</title>
<script>
function fnMenuBg1(elementId)
{
document.getElementById(elementId).style.backgroundColor="#dfdfdf";
}
function fnMenuBg2(elementId)
{
document.getElementById(elementId).style.backgroundColor="";
}
</script>
</head>
<body background="instruction.jpg" topmargin="0">
<%
String statement="";
ResultSet objRs=null;
ResultSet oRsQn=null;
int course_id=0;
int paper_no=0;
int attempt_id=0;
String attempt="";
String paper_name="";
String course_name="";
String trainee_name="";
int number_of_questions=0;
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?result=Session Timed Out.Please, Login again.");
}
if(request.getParameter("course_id")!=null)
{
course_id=Integer.parseInt(request.getParameter("course_id"));
paper_no=Integer.parseInt(request.getParameter("paper_no"));
attempt_id=Integer.parseInt(request.getParameter("attempt_id"));
}
try
{
statement="select * from x_master_elearning_user u,x_master_trainee_detail_online t,x_masterListOfCourses
c,x_masterListOfPapers p where c.course_id=t.course_id and t.user_name=u.user_name and
c.course_id=p.course_id and c.course_id=" + course_id + " and u.user_name='" + user_name + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
if(objRs.next())
{
paper_name=objRs.getString("paper_name");
course_name=objRs.getString("course_name");
trainee_name=objRs.getString("first_name");
}
}
catch(Exception e)
{
out.print("Error occured : " + e);
}
if(attempt_id==1)
{
attempt="first";
}
else
{
if(attempt_id==2)
{
attempt="second";
}
else
{
attempt="third";
}
}
try
{
statement="select * from TRAINING_CENTRE_PARAMETERS";
DB1.setStatement(statement);
oRsQn=(ResultSet)DB1.result();
if(oRsQn.next())
{
number_of_questions=oRsQn.getInt("number_of_questions");
}
else
{
number_of_questions=25;
}
session.setAttribute("number_of_questions","" + number_of_questions);
}
catch(Exception e)
{
out.print("errror occured 2 : " + e);
}
%>
<table border="0" align="right" cellpadding="0" cellspacing="0" >
<tr align="center">
<td height="15" id=home><a href="course_list1_model2.jsp" class="menuLink" onMouseOver="fnMenuBg1('home')"
onMouseOut="fnMenuBg2('home')">
&nbsp;&nbsp; Home&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=back><a href="course_step.jsp?course_id=<%=course_id%>" class="menuLink"
onMouseOver="fnMenuBg1('back')" onMouseOut="fnMenuBg2('back')">
&nbsp;&nbsp; Back&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=profile><a href="view_profile.jsp" class="menuLink" onMouseOver="fnMenuBg1('profile')"
onMouseOut="fnMenuBg2('profile')">&nbsp;&nbsp;View
Profile&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=password><a href="change_password.jsp" class="menuLink"
onMouseOver="fnMenuBg1('password')" onMouseOut="fnMenuBg2('password')">&nbsp;&nbsp;Change
Password&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td width="1" height="15" id=logout><a href="logout.jsp" class="menuLink" onMouseOver="fnMenuBg1('logout')"
onMouseOut="fnMenuBg2('logout')">&nbsp;&nbsp;Logout&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" align="right" class="login" >&nbsp;&nbsp;Login by:<%=user_name%>
</td>
</tr>
</table><br>
<table width="100%">
<tr>
<td height="34" colspan="4" valign="top">&nbsp;</td>
<td align="center" valign="middle">
<p>&nbsp;</p><table border="0" align="right" cellpadding="5">
<tr>
<td align="right" class="infoLabel">Your Name:</td>
<td class="infoValue"><%=trainee_name%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Course Name:</td>
<td class="infoValue"><%=course_name%></td>
</tr>
</table> </td>
</tr>
</table>
<!--start of result display-->
<table width="100%" align="center">
<tr>
<td>
<%
if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate"><strong><font color="#FFffff" size="2" face="Arial, Helvetica, sans-
serif"><%=request.getParameter("result")%></font></strong></marquee>
<%
}
%>
</td>
</tr>
</table>
<!--end of result display-->
<table width="75%" border="0" cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF">
<tr>
<td><table width="100%" border="0" cellpadding="5">
<tr>
<td width="8%">&nbsp;</td>
<td width="92%" class="infoValue">&nbsp;</td>
</tr>
<tr>
<td align="center" class="infoLabel">1.</td>
<td class="infoLabel">You have chosen to attempt the module <font color="#000099"><%=paper_name%></font>
of <font color="#000099"><%=course_name%>.</font></td>
</tr>
<tr>
<td align="center" class="infoLabel">2.</td>
<td class="infoLabel">Click on 'Begin Test' button to start the test.</td>
</tr>
<tr>
<td align="center" class="infoLabel">3.</td>
<td class="infoLabel">It is considered as your <font color="#000099"><%=attempt%></font>
attempt.</td>
</tr>
<tr>
<td align="center" class="infoLabel">4.</td>
<td class="infoLabel">Click on the 'Next' button to move to the next question.</td>
</tr>
<tr>
<td align="center" class="infoLabel">5.</td>
<td class="infoLabel">Click the 'Review' button to review your answers after completing.</td>
</tr>
<tr>
<td align="center" class="infoLabel">6.</td>
<td class="infoLabel">All questions carry equal marks.</td>
</tr>
<tr>
<td align="center" class="infoLabel">7.</td>
<td class="infoLabel">Each test contains <font color="#000099"><%=number_of_questions%></font>
questions.</td>
</tr>
<tr>
<form action="CourseToSession_final.jsp" method=post>
<input type=hidden name="paper_no" value="<%=paper_no%>">
<input type=hidden name="course_id" value="<%=course_id%>">
<input type=hidden name="no_of_attempts" value="<%=request.getParameter("no_of_attempts")%>">
<input type=hidden name="dbase" value="<%=request.getParameter("dbase")%>">
<input type=hidden name="attempt_id" value="<%=attempt_id%>">
<input type=hidden name="paper_id" value="<%=request.getParameter("paper_id")%>">
<td>&nbsp;</td>
<td><input type=submit value="Begin Test" style="font-size:16pt;">
</td>
</form>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
--------------------------------------exam_question.jsp---------------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<jsp:useBean id="DB2" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB2" property="*"/>
<%
String dbase=(String)session.getAttribute("dbase");
String trainee_id=(String)session.getAttribute("trainee_id");
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?result=Session Timed Out.Please, Login again.");
}
int attempt_id=Integer.parseInt((String)session.getAttribute("attempt_id"));
int number_of_questions=Integer.parseInt((String)session.getAttribute("number_of_questions"));
int course_id=Integer.parseInt((String)session.getAttribute("course_id"));
int paper_id=Integer.parseInt((String)session.getAttribute("paper_id"));
String statement=null;
ResultSet objRs=null;
ResultSet objRsQNo=null;
ResultSet objRsQ=null;
int no_of_papers=0,paper_no=0;
String course_name="",trainee_name="",paper_name="";
try
{
statement="select * from x_master_elearning_user u,x_master_trainee_detail_online t,x_masterListOfCourses c
,x_masterListOfPapers p where p.course_id=c.course_id and c.course_id=t.course_id and
t.user_name=u.user_name and c.course_id=" + course_id + " and u.user_name='" + user_name + "' and
p.paper_id=" + paper_id;
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
if(objRs.next())
{
course_name=objRs.getString("course_name");
trainee_name=objRs.getString("first_name");
paper_name=objRs.getString("paper_name");
no_of_papers=objRs.getInt("no_of_papers");
paper_no=objRs.getInt("paper_no");
}
}
catch(Exception e)
{
out.print("error occured 1 :" + e);
}
int i=0;
if(request.getParameter("question_no")==null)
{
i=1;
}
else
{
i=Integer.parseInt(request.getParameter("question_no"))+1;
}
try
{
statement="select * from results where paper_id=" + paper_id + " and course_id=" + course_id + " and trainee_id='" +
trainee_id + "'";
DB1.setStatement(statement);
objRsQNo=(ResultSet)DB1.result();
if(objRsQNo.next())
{
if(i<= number_of_questions)
{
statement="select * from x_masterListOfQuestions where paper_id=" + paper_id + " and question_id=" +
objRsQNo.getInt("qn" + i);
DB2.setStatement(statement);
objRsQ=(ResultSet)DB2.result();
}
}
}
catch(Exception e)
{
out.print("error occured 22 :" + e);
}
%>
<form method="post" action="exam_question_insert.jsp" >
<input type="hidden" name="question_no" value=<%=i%>
<table width="75%" align="right" >
<tr>
<td colspan="3"><hr color="#FFFFff" noshade size="1"></td>
</tr>
<%
try
{
if(objRsQ.next())
{
%>
<tr >
<td width="9%" class="infoLabel">Q No.<strong><%=i%></strong></td>
<td colspan="2" class="infoValue"><%=objRsQ.getString("question")%></td>
</tr>
<tr>
<td>&nbsp;&nbsp;</td>
<td colspan="2" class="infoValue"> <input type="radio" name="choice<%=i%>" value=1>
<%=objRsQ.getString("choice1")%></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" class="infoValue"> <input type="radio" name="choice<%=i%>" value=2>
<%=objRsQ.getString("choice2")%></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" class="infoValue"> <input type="radio" name="choice<%=i%>" value=3>
<%=objRsQ.getString("choice3")%></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2" class="infoValue"> <input type="radio" name="choice<%=i%>" value=4>
<%=objRsQ.getString("choice4")%></td>
</tr>
<%
}
}
catch(Exception e)
{
out.print("error occured 55 : " + e);
}
%>
<tr>
<td colspan="3"><hr color="#FFFFff" noshade size="1"></td>
</tr>
<tr>
<td align=center> </td>
<td align="right">
<%if(i== number_of_questions)
{
%>
<div align="right">
<input type="submit" value="Finish" style="font-size:13pt;" name="submit" onClick="return fnConfirm()">
<%
}
else
{
%>
<input type="submit" value="Next" style="font-size:13pt;" name="submit">
<%
}
%>
</div></td>
<td width="47%" align="right"><input type="submit" value="Review" style="font-size:13pt" name="submit"></td>
</tr>
</table>
</form>
</body>
</html>
--------------------------------------result_calculation-------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<jsp:useBean id="DB2" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB2" property="*"/>
<jsp:useBean id="DB3" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB3" property="*"/>
<jsp:useBean id="DB4" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB4" property="*"/>
<%
String trainee_id=(String)session.getAttribute("trainee_id");
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?result=Session Timed Out.Please, Login again.");
}
int number_of_questions=Integer.parseInt((String)session.getAttribute("number_of_questions"));
int course_id=Integer.parseInt((String)session.getAttribute("course_id"));
int paper_id=Integer.parseInt((String)session.getAttribute("paper_id"));
int attempt_id=Integer.parseInt((String)session.getAttribute("attempt_id"));
String statement=null;
ResultSet objRs=null;
ResultSet objRs1=null;
ResultSet objRsQNo=null;
ResultSet objRsUpdate=null;
ResultSet objRsUpdate1=null;
String trainee_name="",course_name="",paper_name="",course_category="";
int no_of_papers=0,paper_no=0;
try
{
statement="select * from x_master_elearning_user u,x_master_trainee_detail_online t,x_masterListOfCourses c
,x_masterListOfPapers p,x_masterListOfCategory cat where c.course_category_id=cat.course_category_id and
p.course_id=c.course_id and c.course_id=t.course_id and t.user_name=u.user_name and c.course_id=" + course_id
+ " and u.user_name='" + user_name + "' and p.paper_id=" + paper_id;
DB.setStatement(statement);
objRs1=(ResultSet)DB.result();
if(objRs1.next())
{
trainee_name=objRs1.getString("first_name");
course_name=objRs1.getString("course_name");
paper_name=objRs1.getString("paper_name");
course_category=objRs1.getString("course_category");
no_of_papers=objRs1.getInt("no_of_papers");
paper_no=objRs1.getInt("paper_no");
}
}
catch(Exception e)
{
out.print("error occured ");
}
try
{
statement="select * from results where attempt_id=" + attempt_id + " and course_id=" + course_id + " and paper_id="
+ paper_id + " and trainee_id='" + trainee_id + "'";
DB1.setStatement(statement);
objRsQNo=(ResultSet)DB1.result();
objRsQNo.next();
}
catch(Exception e)
{
out.print("error occured 22 :"+e);
}

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>e-Learning</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function fnMenuBg1(elementId)
{
document.getElementById(elementId).style.backgroundColor="#dfdfdf";
}
function fnMenuBg2(elementId)
{
document.getElementById(elementId).style.backgroundColor="";
}
function fnConfirm()
{
return confirm("Are you sure you want to FINISH the exam?");
}
function fnClick()
{
location.href="course_tutorial1.jsp?course_id=<%=course_id%>";
}
</script>
</head>
<body background="result.jpg" >
<table border="0" align="right" cellpadding="0" cellspacing="0" >
<tr align="center">
<td height="15" id=home><a href="course_list1_model2.jsp" class="menuLink" onMouseOver="fnMenuBg1('home')"
onMouseOut="fnMenuBg2('home')">
&nbsp;&nbsp; Home&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=profile><a href="view_profile.jsp" class="menuLink" onMouseOver="fnMenuBg1('profile')"
onMouseOut="fnMenuBg2('profile')">&nbsp;&nbsp;View
Profile&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=password><a href="change_password.jsp" class="menuLink"
onMouseOver="fnMenuBg1('password')" onMouseOut="fnMenuBg2('password')">&nbsp;&nbsp;Change
Password&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td width="1" height="15" id=logout><a href="logout.jsp" class="menuLink" onMouseOver="fnMenuBg1('logout')"
onMouseOut="fnMenuBg2('logout')">&nbsp;&nbsp;Logout&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" align="right" class="login" >&nbsp;&nbsp;Login by:<%=user_name%>
</td>
</tr>
</table><br>
<table width="100%">
<tr>
<td height="34" colspan="4" valign="top">&nbsp;</td>
<td align="center" valign="middle">
<table border="0" align="right" cellpadding="5">
<tr>
<td align="right" class="infoLabel">Your Name:</td>
<td class="infoValue"><%=trainee_name%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Course Name:</td>
<td class="infoValue"><%=course_name%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Module Name:</td>
<td class="infoValue"><%=paper_name%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Module No.:</td>
<td class="infoValue"><%=paper_no%>/<%=no_of_papers%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Attempt No.:</td>
<td class="infoValue"><%=attempt_id%>/3</td>
</tr>
</table> </td>
</tr>
</table>
<!--start of result display-->
<!--end of result display-->
<table width="100%" height="100%" border="0">
<tr>
<td valign="top">
<table width="75%" border="0">
<tr>
</tr>
<%
int i=1;
int total=0;
String back_color="",choice1="",choice2="",choice3="",choice4="";
int objRsQNans=0;
String question="";
while(i<= number_of_questions)
{
int user_ans=0;
try
{
statement="select * from x_masterListOfQuestions where paper_id=" + paper_id + " and question_id=" +
objRsQNo.getInt("qn" + i);
DB2.setStatement(statement);
objRs=(ResultSet)DB2.result();
if(objRs.next())
{
user_ans=objRs.getInt("ans");
choice1=objRs.getString("choice1");
choice2=objRs.getString("choice2");
choice3=objRs.getString("choice3");
choice4=objRs.getString("choice4");
question=objRs.getString("question");
}
objRsQNans=objRsQNo.getInt("ans" + i);

}
catch(Exception e)
{
out.println("error occured 55 : "+e);
}
%>
<tr>
<td width="5%" rowspan="5" align="left" valign="top" class="infoLabel"><%=i%>.</td>
<td width="95%" class="infoValue"><%=question%></td>
</tr>
<%if(user_ans==1)
{
back_color="";
}
else
{
back_color="";
}
%>
<tr <%=back_color%>>
<%if(objRsQNans==1)
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=1 checked disabled>
<%=choice1%>
<%if(user_ans==1)
{%>
<img src="qbright.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-
serif">1
mark</font>
<%total=total+1;%>
<%
}
else
{%>
<img src="qbwrong.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica,
sans-serif">0
mark</font>
<%}%>
</td>
<%
}
else
{%>
<%if(objRsQNans==0)
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=1 disabled>
<%=choice1%><img src="not_attempted.gif" height="20" border="0"><font color="#FF0000" size="1" face="Verdana,
Arial, Helvetica, sans-serif">Not
attempted</font></td>
<%}
else
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=1 disabled>
<%=choice1%></td>
<%}%>
<%}%>
</tr>
<%
if(user_ans==2)
{
back_color="";
}
else
{
back_color="";
}
%>
<tr <%=back_color%>>
<%if(objRsQNans==2)
{%>
<td class="infoValue" >
<input type="radio" name="choice<%=i%>" value=2 checked disabled>
<%=choice2%>
<%if(user_ans==2)
{%>
<img src="qbright.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-
serif">1
mark</font>
<%total=total+1;%>
<%
}
else
{%>
<img src="qbwrong.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica,
sans-serif">0
mark</font>
<%}%>
</td>
<%}
else
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=2 disabled>
<%=choice2%></td>
<%}%>
</tr>
<%
if(user_ans==3)
{
back_color="";
}
else
{
back_color="";
}
%>
<tr <%=back_color%>>
<%if(objRsQNans==3)
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=3 checked disabled>
<%=choice3%>
<%if(user_ans==3)
{%>
<img src="qbright.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-
serif">1
mark</font>
<%total=total+1;%>
<%
}
else
{%>
<img src="qbwrong.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica,
sans-serif">0
mark</font>
<%}%>
</td>
<%
}
else
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=3 disabled>
<%=choice3%></td>
<%}%>
</tr>
<%
if(user_ans==4)
{
back_color="";
}
else
{
back_color="";
}
%>
<tr <%=back_color%>>
<%if(objRsQNans==4)
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=4 checked disabled>
<%=choice4%>
<%if(user_ans==4)
{%>
<img src="qbright.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-
serif">1
mark</font>
<%total=total+1;%>
<%
}
else
{%>
<img src="qbwrong.gif" height="20" border="0"><font color="#FF0000" size="2" face="Verdana, Arial, Helvetica,
sans-serif">0
mark</font>
<%}%>
</td>
<%
}
else
{%>
<td class="infoValue">
<input type="radio" name="choice<%=i%>" value=4 disabled>
<%=choice4%></td>
<%}%>
</tr>
<tr>
<td colspan="2"><hr color="#FFffff" size="1" ></td>
</tr>
<%
i=i+1;
}
%>
<tr>
<td colspan="2"><font color="#FF0000" size="5" face="Arial, Helvetica, sans-serif">TOTAL
MARKS : <strong><%=total%>/<%=number_of_questions%></strong><br>
</strong>
<%
try
{
statement="select * from results where attempt_id=" + attempt_id + " and course_id=" + course_id + " and paper_id="
+ paper_id + " and trainee_id='" + trainee_id + "'";
DB3.setStatement(statement);
objRsUpdate=(ResultSet)DB3.resultUpdate();
objRsUpdate.next();
objRsUpdate.updateInt("Result",total);
objRsUpdate.updateRow();
}
catch(Exception e)
{
out.println("eror occured 66 : " + e);
}
try
{
statement="select * from x_master_trainee_detail_online where course_id=" + course_id + " and trainee_id='" +
trainee_id + "'";
DB4.setStatement(statement);
objRsUpdate1=(ResultSet)DB4.resultUpdate();
objRsUpdate1.next();
objRsUpdate1.updateInt("paper_id" + paper_no,paper_id);
objRsUpdate1.updateInt("paper" + paper_no + "_no_of_attempts",attempt_id);
objRsUpdate1.updateInt("paper" + paper_no + "_marks",total);
objRsUpdate1.updateInt("is_attended_exam",1);
java.util.Date now=new java.util.Date();
java.sql.Date date = new java.sql.Date(now.getYear(),now.getMonth(),now.getDate());
objRsUpdate1.updateDate("paper" + paper_no + "_appeared_on",date);
objRsUpdate1.updateInt("total_marks",number_of_questions);
if(total>(number_of_questions /2))
{
objRsUpdate1.updateInt("is_paper" + paper_no + "_completed",1);
objRsUpdate1.updateDate("paper" + paper_no + "_completed_date",date);
out.print("STATUS:<strong>PASS</strong> <br>");
if(paper_no==no_of_papers)
{
objRsUpdate1.updateInt("is_successfully_completed",1);
objRsUpdate1.updateDate("course_completed_date",date);
}
}
else
{
out.print("STATUS:<strong>FAIL</strong> <br>");
}
objRsUpdate1.updateRow();
}
catch(Exception e)
{
out.println("error occured 77 : " + e);
}
%>
ATTEMPT NO.:<strong><%=attempt_id%></strong> </FONt></td>
</tr>
<tr>
<td colspan="2"><hr noshade color="#FFFFFF" size="1"></td>
</tr>
<tr>
<td colspan="2"><input type=button value="Continue" onClick="fnClick()"></td>
</tr>
</table>
</td>
</tr>
</table>
<%
session.removeAttribute("paper_no");
session.removeAttribute("paper_id");
session.removeAttribute("attempt_id");
%>
<p>&nbsp;</p>
</body>
</html>
-------------------------------view_result.jsp--------------------------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<%
int course_id=0;
int is_objRs_present=0;
String statement="";
ResultSet objRs=null;
ResultSet objRsPaper=null;
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.sendRedirect("course_list_index2.jsp?result=Session Timed Out.Please, Login again.");
}
String trainee_name="";
String course_name="";
if(request.getParameter("course_id")!=null)
{
course_id=Integer.parseInt(request.getParameter("course_id"));
}
try
{
statement="select * from x_master_elearning_user u,x_master_trainee_detail_online t,x_masterListOfCourses
c,x_masterListOfCategory cat where c.course_id=t.course_id and t.user_name=u.user_name and
c.course_category_id=cat.course_category_id and c.course_id=" + course_id + " and u.user_name='" + user_name +
"'";
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
if(objRs.next())
{
trainee_name=objRs.getString("first_name");
course_name=objRs.getString("course_name");
is_objRs_present=1;
}
else
{
response.sendRedirect("course_list_index2.asp?result=Session Timed out");
}
session.setAttribute("trainee_id",objRs.getString("trainee_id"));
}
catch(Exception e)
{
%>error occured : <%=e%><%
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>e-Learning</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.activeMenu{
font-family:verdana;font-weight:bold;font-size:11px;color:#666666;text-decoration:none;
}
A.menuLink{
font-family:verdana;font-size:11px;color:#666666;text-decoration:none;
}
A.menuLink:hover{
font-family:verdana;font-size:11px;color:#666666;text-decoration:none;
}
TD.infoLabel{
font-family:verdana;font-size:11px;color:#666666;text-decoration:none;
}
TD.infoValue{
font-family:verdana;font-weight:bold;font-size:11px;color:#336699;text-decoration:none;
}
TD.login{
font-family:verdana;font-size:11px;color:#111111;text-decoration:none;
}
</style>
<script>
function fnMenuBg1(elementId)
{
document.getElementById(elementId).style.backgroundColor="#dfdfdf";
}
function fnMenuBg2(elementId)
{
document.getElementById(elementId).style.backgroundColor="";
}
function fnClick(course_id)
{
location.href="course_step.jsp?course_id=" + course_id;
}
</script>
</head>
<body background="result.jpg" topmargin="0">
<table border="0" align="right" cellpadding="0" cellspacing="0" >
<tr align="center">
<td height="15" id=home><a href="course_list1_model2.jsp" class="menuLink" onMouseOver="fnMenuBg1('home')"
onMouseOut="fnMenuBg2('home')">
&nbsp;&nbsp; Home&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=back><a href="course_step.jsp?course_id=<%=course_id%>" class="menuLink"
onMouseOver="fnMenuBg1('back')" onMouseOut="fnMenuBg2('back')">
&nbsp;&nbsp; Back&nbsp;&nbsp; </a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=profile><a href="view_profile.jsp" class="menuLink" onMouseOver="fnMenuBg1('profile')"
onMouseOut="fnMenuBg2('profile')">&nbsp;&nbsp;View
Profile&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" id=password><a href="change_password.jsp" class="menuLink"
onMouseOver="fnMenuBg1('password')" onMouseOut="fnMenuBg2('password')">&nbsp;&nbsp;Change
Password&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td width="1" height="15" id=logout><a href="logout.jsp" class="menuLink" onMouseOver="fnMenuBg1('logout')"
onMouseOut="fnMenuBg2('logout')">&nbsp;&nbsp;Logout&nbsp;&nbsp;</a></td>
<td width="1" height="15" class="infoLabel">|</td>
<td height="15" align="right" class="login" >&nbsp;&nbsp;Login by:<%=user_name%>
</td>
</tr>
</table><br>
<table width="100%">
<tr>
<td height="34" colspan="4" valign="top">&nbsp;</td>
<td align="center" valign="middle">
<p>&nbsp;</p><table border="0" align="right" cellpadding="5">
<tr>
<td align="right" class="infoLabel">Your Name:</td>
<td class="infoValue"><%=trainee_name%></td>
</tr>
<tr>
<td align="right" class="infoLabel">Course Name:</td>
<td class="infoValue"><%=course_name%></td>
</tr>
</table> </td>
</tr>
</table>

<table width="100%" height="858" >
<tr>
<td align="center" valign="top">
<!--start of result display-->
<table width="100%" align="center">
<tr>
<td>
<%
if(request.getParameter("result")!=null)
{
%>
<marquee loop="1" behavior="alternate"><strong><font color="#FFffff" size="2" face="Arial, Helvetica, sans-
serif"><%=request.getParameter("result")%></font></strong></marquee>
<%
}
%>
</td>
</tr>
</table>
<!--end of result display-->
<br>
<table width="50%" border="0" align="left" cellpadding="3" cellspacing="3" bordercolorlight="#FFffff">
<%
try
{
statement="select * from x_masterListOfPapers where course_id=" + course_id;
DB1.setStatement(statement);
objRsPaper=(ResultSet)DB1.result();
}
catch(Exception e)
{
%>
error occured in paper : <%=e%>
<%
}
try
{
if(is_objRs_present==1)
{
int is_previous_paper_completed=1;
int total_marks=0;
while(objRsPaper.next())
{
int paper_no=objRsPaper.getInt("paper_no");
int no_of_attempts=0;
int attempt_id=0;
int marks=0;
java.util.Date appeared_on=null;
String back_color="";
String attempt_message="";
String paper_name=objRsPaper.getString("paper_name");
no_of_attempts=objRs.getInt("paper" + paper_no + "_no_of_attempts");
int paper_id=objRsPaper.getInt("paper_id");
String dbase=objRsPaper.getString("dbase");
int is_paper_completed=objRs.getInt("is_paper" + paper_no + "_completed");
if(paper_no==1)
{
total_marks=objRs.getInt("total_marks");
}
if(is_paper_completed==1)
{
back_color="bgcolor=#ffffcc";
}
else
{
back_color="";
}
if(is_paper_completed==1)
{
attempt_message="Successfully Completed ";
}
else
{
if(is_previous_paper_completed==0)
{
attempt_message="Not yet Eligible as you have not completed previous modules";
}
else
{
switch(no_of_attempts)
{
case 0:
attempt_id=1;
attempt_message="Not completed, You have a total of 3 attempts";
break;
case 1:
attempt_id=2;
attempt_message="Not completed,1 attempt exhausted ,you have 2 more attempts.";
break;
case 2:
attempt_id=3;
attempt_message="Not completed,2 attempts exhausted,you have 1 more attempt.";
break;
case 3:
attempt_message="All the attempts are exhausted and so you cannot complete the e ";
break;
default:
attempt_message="Not completed, and you are eligible for the exam ";
} } } %>
<tr>
<td colspan="3"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
Module.<%=paper_no%> : <%=paper_name%>&nbsp; </font></strong>
</td> </tr>
<tr>
<td>&nbsp;</td><td colspan="2"><font color="#FFFF00" size="2" face="Verdana, Arial, Helvetica, sans-
serif"><%=attempt_message%></font></td>
</tr>
<%if(no_of_attempts>0)
{%>
<tr>
<td width="7%" class="infoLabel" >&nbsp;</td>
<td width="31%" class="infoLabel">Marks obtained :</td>
<%
marks=(objRs.getInt("paper" + paper_no + "_marks")*100)/total_marks;
%>
<td width="62%" class="infoValue"><%=marks%>%</td>
</tr>
<% appeared_on=objRs.getDate("paper" + paper_no + "_appeared_on");
String appeared_on_str=appeared_on.getDate() + "-" + (appeared_on.getMonth()+1) + "-" +
(appeared_on.getYear()+1900);
%>
<tr>
<td>&nbsp;</td>
<td class="infoLabel">Appeared On :</td>
<td class="infoValue"><%=appeared_on_str%></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="infoLabel">No. of Attempts :</td>
<td class="infoValue"><%=no_of_attempts%></td>
</tr>
<%}%>
<tr>
<td colspan="3"><hr noshade color="#FFFFCC"></td>
</tr>
<% is_previous_paper_completed=is_paper_completed;} %>
<tr>
<td class="infoLabel" colspan="3">Pass precentage :50%</td>
</tr>
<% }
else
{ out.print("NIL");
}
%>
</table> <td></tr>
<% }
catch(Exception e)
{ out.print("error occured in while of paper : " + e);
}
%>
</table>
</body>
</html>

8.2 Back End

------------------------------------DBConnection.class---------------------------------------------
package INCLUDES;
import java.io.Serializable;
import java.sql.*;
import java.io.*;
public class DBConnection
{
String strStatement="";
ResultSet rs=null;
Connection conn=null;
public void setStatement(String statement)
{ this.strStatement=statement; }
public ResultSet result()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn=DriverManager.getConnection
("jdbc:odbc:ELEARNING_DATASOURCE","","");
Statement stat=conn.createStatement();
rs=stat.executeQuery(strStatement);
}
catch(Exception e)
{ e.printStackTrace();
}
return rs;
}
public ResultSet resultUpdate()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn=DriverManager.getConnection
("jdbc:odbc:ELEARNING_DATASOURCE","","");
Statement stat=conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs=stat.executeQuery(strStatement);
}
catch(Exception e)
{ e.printStackTrace();
}
return rs;
}
public int insert()
{
int count=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn=DriverManager.getConnection
("jdbc:odbc:ELEARNING_DATASOURCE","","");
Statement stat=conn.createStatement();
count=stat.executeUpdate(strStatement);
}
catch(Exception e)
{ e.printStackTrace();
}
return count;
}
public void closeConn()
{
try
{ conn.close();
}
catch(Exception e)
{ e.printStackTrace();
}
}
}
------------------------------------------signup_insert.jsp---------------------------------------
<%@ page import="INCLUDES.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
String user_name=request.getParameter("user_name");
ResultSet objRs=null;
String statement="";
try
{
statement="select * from x_master_elearning_user where user_name='" +
user_name + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.resultUpdate();
if(objRs.next())
{
response.sendRedirect("signup.jsp?result=User name already exists");
}
else
{
objRs.updateString("user_name",user_name);
objRs.updateString("pass_word",request.getParameter("pass_word"));
objRs.updateString("first_name",request.getParameter("trainee_name"));
objRs.updateString("designation",request.getParameter("designation"));
objRs.updateString("email",request.getParameter("email"));
objRs.updateInt("is_validated",0);
objRs.updateString("validation_code","xxxx");
objRs.updateString("city",request.getParameter("city"));
objRs.updateString("country",request.getParameter("country"));
objRs.insertRow();
response.sendRedirect("course_list_index2.jsp?result=
Succesfully regsitered.Please, Login to access other features.");
}
}
catch(Exception e)
{ out.print("error occured " + e);
}
%>
---------------------------------------user_login_verification.jsp------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
String user_name=request.getParameter("user_name");
session.setAttribute("user_name",user_name);
String pass_word=request.getParameter("pass_word");
String statement="SELECT * from x_master_elearning_user where user_name='" + user_name + "'";
try{
DB.setStatement(statement);
ResultSet rs=(ResultSet)DB.result();
if(rs.next()){
if(pass_word.equals(rs.getString("pass_word"))){
response.sendRedirect("course_list1_model2.jsp");
}
else{
response.sendRedirect("course_list_index2.jsp?
result=Incorrect Username/Password");
}
}
else{
response.sendRedirect("course_list_index2.jsp?
result=Incorrect Username/Password");
}
}
catch(Exception ex){
ex.printStackTrace();
}
%>
----------------------------------------profile_update.jsp----------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
String user_name=(String)session.getAttribute("user_name");
if(user_name==null)
{
response.redirect("course_list_index2.jsp?result=Session timed out.Please Login again.");
}
ResultSet objRs=null;
String statement="";
try
{
statement="select * from x_master_elearning_user where user_name='" + user_name + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.resultUpdate();
if(objRs.next())
{
objRs.updateString("first_name",request.getParameter("trainee_name"));
objRs.updateString("designation",request.getParameter("designation"));
objRs.updateString("email",request.getParameter("email"));
objRs.updateString("city",request.getParameter("city"));
objRs.updateString("country",request.getParameter("country"));
objRs.updateRow();
response.sendRedirect("view_profile.jsp?result=Succesfully updated profile.");
}
else
{
response.sendRedirect("view_profile.jsp?result=Sorry.You Profile could not be updated .");
}
}
catch(Exception e)
{
out.print("error occured " + e);
}
%>
---------------------------------------------password_update.jsp--------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
String user_name=(String)session.getAttribute("user_name");
String old_pass=request.getParameter("old_pass");
String new_pass=request.getParameter("new_pass");
ResultSet objRs=null;
String statement="";
try
{
statement="select * from x_master_elearning_user where user_name='" + user_name + "' and pass_word='" +
old_pass + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.resultUpdate();
if(objRs.next())
{
objRs.updateString("pass_word",new_pass);
objRs.updateRow();
response.sendRedirect("course_list_index2.jsp?result=Password Changed Successfully.Please Login Again.");
}
else
{
response.sendRedirect("change_password.jsp?result=Incorrect Password.Try Again!");
}
}
catch(Exception e)
{
out.print("error occured " + e);
}
%>
--------------------------------------------enroll.jsp--------------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<%
int course_id=Integer.parseInt(request.getParameter("course_id"));
int no_of_papers=0;
String statement="";
try
{
statement="select no_of_papers from x_masterListOfCourses where course_id=" + course_id;
DB1.setStatement(statement);
ResultSet objRs=(ResultSet)DB1.result();
if(objRs.next())
{
no_of_papers=objRs.getInt("no_of_papers");
}
}
catch(Exception e)
{
out.print("error occured 11:" + e);
}
try
{
String user_name=(String)session.getAttribute("user_name");
java.util.Date now=new java.util.Date();
java.sql.Date date=new java.sql.Date(now.getYear(),now.getMonth(),now.getDate());
String trainee_id="OL_" + course_id + "_" + user_name;
statement="select * from x_master_trainee_detail_online";
DB.setStatement(statement);
ResultSet objRsInsert=(ResultSet)DB.resultUpdate();
objRsInsert.next();
objRsInsert.updateString("trainee_id",trainee_id);
session.setAttribute("trainee_id",trainee_id);
objRsInsert.updateString("user_name",user_name);
objRsInsert.updateInt("is_registered",1);
objRsInsert.updateInt("is_paper1_tutorial_viewed",0);
objRsInsert.updateInt("is_paper2_tutorial_viewed",0);
objRsInsert.updateInt("is_paper3_tutorial_viewed",0);
objRsInsert.updateInt("is_paper4_tutorial_viewed",0);
objRsInsert.updateInt("is_paper5_tutorial_viewed",0);
objRsInsert.updateInt("is_attended_exam",0);
objRsInsert.updateInt("course_id",course_id);
objRsInsert.updateInt("paper1_no_of_attempts",0);
objRsInsert.updateInt("paper2_no_of_attempts",0);
objRsInsert.updateInt("paper3_no_of_attempts",0);
objRsInsert.updateInt("paper4_no_of_attempts",0);
objRsInsert.updateInt("paper5_no_of_attempts",0);
objRsInsert.updateInt("is_paper1_completed",0);
objRsInsert.updateInt("is_paper2_completed",0);
objRsInsert.updateInt("is_paper3_completed",0);
objRsInsert.updateInt("is_paper4_completed",0);
objRsInsert.updateInt("is_paper5_completed",0);
objRsInsert.updateInt("paper1_marks",0);
objRsInsert.updateInt("paper2_marks",0);
objRsInsert.updateInt("paper3_marks",0);
objRsInsert.updateInt("paper4_marks",0);
objRsInsert.updateInt("paper5_marks",0);
objRsInsert.updateDate("doe",date);
objRsInsert.updateInt("no_of_papers",no_of_papers);
objRsInsert.insertRow();
response.sendRedirect("course_step.jsp?result=Enrolled successfully.&course_id=" + course_id);
}
catch(Exception e)
{
out.print("error occured : " + e);
}
%>
----------------------------------------update_tutorial_viewed.jsp---------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
int course_id=0;
String statement="";
ResultSet objRs=null;
int paper_id=Integer.parseInt(request.getParameter("paper_id"));
int paper_no=Integer.parseInt(request.getParameter("paper_no"));
String file_name=request.getParameter("doc");
String user_name=(String)session.getAttribute("user_name");
String col1="paper_id" + paper_no;
String col2="is_paper" + paper_no + "_tutorial_viewed";
if(request.getParameter("course_id")!=null)
{
course_id=Integer.parseInt(request.getParameter("course_id"));
}
try
{
statement="select * from x_master_trainee_detail_online where course_id=" + course_id + " and user_name='" +
user_name + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.resultUpdate();
objRs.next();
objRs.updateInt(col1, paper_id);
objRs.updateInt(col2,1);
objRs.updateRow();
response.sendRedirect(file_name);
}
catch(Exception e)
{
out.println("error occured 11 : " + e);
}
%>
------------------------------------CourseToSession_final.jsp-----------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<jsp:useBean id="DB1" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB1" property="*"/>
<jsp:useBean id="DB2" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB2" property="*"/>
<jsp:useBean id="DB3" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB3" property="*"/>
<jsp:useBean id="DB4" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB4" property="*"/>
<%
String statement=null;
ResultSet objRs=null;
ResultSet oRsQn=null;
ResultSet oRsTotQns=null;
int number_of_questions=3;
int course_id=0;
int paper_no=0,paper_id=0,attempt_id=0;
String trainee_id=null;
int total_qns=0;
if(request.getParameter("course_id")!=null)
{
course_id=Integer.parseInt(request.getParameter("course_id"));
session.setAttribute("course_id",""+course_id);
trainee_id=(String)session.getAttribute("trainee_id");
paper_no=Integer.parseInt(request.getParameter("paper_no"));
session.setAttribute("paper_no",""+paper_no);
attempt_id=Integer.parseInt(request.getParameter("attempt_id"));
session.setAttribute("attempt_id",""+attempt_id);
paper_id=Integer.parseInt(request.getParameter("paper_id"));
session.setAttribute("paper_id",""+paper_id);
}
try
{
statement="select * from x_master_trainee_detail_online where course_id=" + course_id + " and trainee_id='" +
trainee_id + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.result();
if(objRs.next())
{
String viewed_field="is_paper" + paper_no + "_tutorial_viewed";
out.print(viewed_field);
if(objRs.getInt(viewed_field)==0)
{
response.sendRedirect("course_tutorial1.jsp?course_id=" + course_id + "&result=You must first read the
tutorials.You may <a href=view_document.jsp?course_id=" + course_id + ">click here</a>.");
}
}
}
catch(Exception e)
{
out.print("errror occured 1 : " + e);
}
number_of_questions=Integer.parseInt((String)session.getAttribute("number_of_questions"));
try
{
statement="select count(*) as total_qns from x_masterListOfQuestions where paper_id=" + paper_id;
DB2.setStatement(statement);
oRsTotQns=(ResultSet)DB2.result();
if(oRsTotQns.next())
{
total_qns=oRsTotQns.getInt("total_qns");
}
}
catch(Exception e)
{
out.print("errror occured 3 : " + e);
}
if(total_qns < number_of_questions)
{
response.sendRedirect("course_tutorial1.jsp?result=This Course contains less than " + number_of_questions + "
questions. Hence Test is not permitted. Please select some other course");
}
int last_qn=total_qns-1;
int i=0;
ResultSet oRsID=null;
int qn_array[]=new int[total_qns];
try
{
statement="select question_id from x_masterListOfQuestions where paper_id=" + paper_id;
DB3.setStatement(statement);
oRsID=(ResultSet)DB3.result();
while(oRsID.next())
{
qn_array[i]=oRsID.getInt("question_id");
i=i+1;
}
}
catch(Exception e)
{
out.print("errror occured 4 : " + e);
}
/*randomize
for j=last_qn to number_of_questions step -1
random_no=int(rnd* last_qn)
qn_array(random_no)=qn_array(last_qn)
redim preserve qn_array(last_qn)
last_qn=last_qn-1
next
redim preserve qn_array(ubound(qn_array)-1)

for i=0 to ubound(qn_array)
for j=0 to (ubound(qn_array)-i-1)
if qn_array(j)>qn_array(j+1) then
temp=qn_array(j)
qn_array(j)=qn_array(j+1)
qn_array(j+1)=temp
end if
next
next
response.write("sorted list")
*/
try
{
String qn_qns_str="";
String qn_qns_val="";
String qn_ans_str="";
String qn_ans_val="";
for(int k=0;k<i;k++)
{
qn_qns_str=qn_qns_str + ",qn" + (k+1);
qn_qns_val=qn_qns_val + "," + qn_array[k];
qn_ans_str=qn_ans_str + ",ans" + (k+1);
qn_ans_val=qn_ans_val + ",0";
}
statement="insert into results(course_id,trainee_id,paper_id,attempt_id" + qn_qns_str + qn_ans_str + ") values(" +
course_id + ",'" + trainee_id + "'," + paper_id + "," + attempt_id + qn_qns_val + qn_ans_val + ")";
DB4.setStatement(statement);
int count=(int)DB4.insert();
if(count>0)
{
out.println("successfully");
}
else
{
out.print("failure");
}
}
catch(Exception e)
{
out.print("error occured 55 : " + e);
}

try
{
response.sendRedirect("exam_question.jsp");
}
catch(Exception e)
{
out.println("error occured :" + e);
}

%>
----------------------------------------exam_question_insert.jsp-------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
String trainee_id=(String)session.getAttribute("trainee_id");
int number_of_questions=Integer.parseInt((String)session.getAttribute("number_of_questions"));
int course_id=Integer.parseInt((String)session.getAttribute("course_id"));
int paper_id=Integer.parseInt((String)session.getAttribute("paper_id"));
int attempt_id=Integer.parseInt((String)session.getAttribute("attempt_id"));
int i=Integer.parseInt(request.getParameter("question_no"));
String statement=null;
ResultSet objRs=null;
try
{
statement="select * from results where attempt_id=" + attempt_id + " and course_id=" + course_id + " and paper_id="
+ paper_id + " and trainee_id='" + trainee_id + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.resultUpdate();
objRs.next();
if(request.getParameter("choice" + i)!=null)
{
objRs.updateInt("ans" + i,Integer.parseInt(request.getParameter("choice" + i)));
}
else
{
objRs.updateInt("ans" + i,0);
}
objRs.updateRow();
}
catch(Exception e)
{
out.print("error occured 11 : " + e);
}
if(request.getParameter("submit").equals("Review"))
{
response.sendRedirect("question_review.jsp");
}
else
{
if(i<number_of_questions)
{
response.sendRedirect("exam_question.jsp?question_no=" + i);
}
else
{
response.sendRedirect("result_calculation.jsp");
}
}
%>
-------------------------------review_insert.jsp-------------------------------------------
<%@ page import="INCLUDES.DBConnection"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<jsp:useBean id="DB" scope="page" class="INCLUDES.DBConnection"/>
<jsp:setProperty name="DB" property="*"/>
<%
String trainee_id=(String)session.getAttribute("trainee_id");
int number_of_questions=Integer.parseInt((String)session.getAttribute("number_of_questions"));
int course_id=Integer.parseInt((String)session.getAttribute("course_id"));
int paper_id=Integer.parseInt((String)session.getAttribute("paper_id"));
int attempt_id=Integer.parseInt((String)session.getAttribute("attempt_id"));
int i=1;
String statement=null;
ResultSet objRs=null;
try
{
statement="select * from results where attempt_id=" + attempt_id + " and course_id=" + course_id + " and paper_id="
+ paper_id + " and trainee_id='" + trainee_id + "'";
DB.setStatement(statement);
objRs=(ResultSet)DB.resultUpdate();
objRs.next();
while(i<=number_of_questions)
{
if(request.getParameter("choice" + i)!=null)
{
objRs.updateInt("ans" + i,Integer.parseInt(request.getParameter("choice" + i)));
}
else
{
objRs.updateInt("ans" + i,0);
}
i=i+1;
}
objRs.updateRow();
}
catch(Exception e)
{
out.print("error occured 11 : " + e);
}
response.sendRedirect("result_calculation.jsp");
%>
Main Menu

MAIN MENU

Bollywood India
Kareena Childhood(13)
Deepika Childhood(7)
Katrina Childhood(8)
ARRahman (11)
Asin Childhood(8)
Ranbir Childhood(9)
Aishwarya Childhood(9)
Preity Childhood(12)
kajol Childhood(9)
Bipasa Childhood(7)
Bollywood Quiz(7)
Kollywood India
Vijay Childhood(10)
Vijay Marriage(10)
Surya Daughter(9)
Ajith Daughter(9)
Surya Childhood(7)
Trisha Childhood(9)
Kolywood Daughters
Sneha Childhood(8)
AR.Rahman Childhood
Asin Childhood(8)
Kushboo Childhood(5)
Jayalalitha(4)
MGR(1)
Rajini Marriage(2)
Glamour India
[NOT for Decent People]
Genelia(7)
Anushka(13)
Tamanna(10)
Priyamani(15)
Illiana(14)
Jyothi(6)
Namitha(9)
Bhuvaneswari(6)
Kaif(6)
Mallika(12)
Assorted(10)
Asin-Salman
More!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Octopus has 3 hearts
How to Bend Water?
How Hair Rises?
Where is Stomata?
Divine-Delight
BillGates Arrested Photo
Low Broadband Speed?
Elephant-Massaging(4)
Copycat Hindi Songs
Funny-Puppet(video)
Smallest Girl In the Earth
Top 10 Illusions
Sugar In Soda(Video)
A Complete Project on Java(JSP)
ASP.NET C# codes

CONTENTS IN THIS SITE

Report

1 Declaration

2. Certificate

3. Acknowledgements

Table of Contents

4 : Introduction (purpose,existing
sytem,hardware & software requirements)

5: System Development Life
Cycle

6 : Requirement Analysis

System Design(E-R Diagram,Table Structure)

8 : Complete jsp source
code for Elearning

9. Testing

10 : Screenshots

11 : Conclusion

12 : Limitations

13: Further Enhancements

14 : Bibliography & References
Thanks for your visit
Google Search

Search



Disclaimer and Copy Right

You might also like