February 1, 2012 at 10:54 AM
We are providing you a simple application.
Create table test(ques,op1,op2,op3,op4,ans) and answers(id,ans).
Then try the following code:
1)form.jsp:
<%@page import="java.sql.*"%>
<html>
<form method="post" action="result.jsp">
<table>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root";, "root");
Statement st=connection.createStatement();
ResultSet rs=st.executeQuery("Select * from test");
int i=1;
while(rs.next()){
%>
<tr><td><%=i%></td><td><%=rs.getString("ques")%></td><td><input type="radio" value="<%=rs.getString("op1")%>" name="radio<%=i%>"/><%=rs.getString("op1")%></td><td><input type="radio" value="<%=rs.getString("op2")%>" name="radio<%=i%>"/><%=rs.getString("op2")%></td><td><input type="radio" value="<%=rs.getString("op3")%>" name="radio<%=i%>"/><%=rs.getString("op3")%></td><td><input type="radio" value="<%=rs.getString("op4")%>" name="radio<%=i%>"/><%=rs.getString("op4")%></td></tr>
<%
i++;
}
%>
<tr><td><input type="submit" value="submit"></td></tr>
</table>
</form>
</html>
2)result.jsp:
<%@page import="java.sql.*"%>
<%
String st[]=new String[10];
for(int i=0;i<st.length;i++){
int j=i+1;
st[i]=request.getParameter("radio"+j);
System.out.println(st[i]);
}
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root";, "root");
Statement stmt=connection.createStatement();
ResultSet rs=stmt.executeQuery("Select ans from answers");
String ans="";
while(rs.next()){
ans+=rs.getString("ans")+" ";
}
int count=0;
String answers[]=ans.split(" ");
for(int i=0;i<answers.length;i++){
if(st[i].equals(answers[i])){
count++;
}
}
out.println("Your "+count+" answers are correct");
%>
For more information, visit the following link:
http://www.roseindia.net/jsp/online-quiz-application-jsp.shtml
Related Tutorials/Questions & Answers:
online examinationonline examination Hi, i am doing
online examination project, i have some problem with get a paper form database and count the right answer and display the result. So, i request to you please help me come out to this problem
online examinationonline examination coding for multiple choice question in jsp
We are providing you a simple application.
Create table test...:
http://www.roseindia.net/jsp/
online-quiz-application-jsp.shtml
Advertisements
Online Examination SystemOnline Examination System Hi..
I have to create a
Online Examination system using struts, Hibernate and stateful session beans..
I Wanna know the use of stateful session beans in project
online examination system project in jsponline examination system project in jsp How many and which data tables are required for
online examination system project in jsp in java.
please give me the detailed structure of each table
online examination system project in jsponline examination system project in jsp thanks for providing me 6 tables for
online examination system.
I want to know what will the id field of Answers1 table contain?
Will it contain same id for all the questions of Set1 &
online examination system project in jsponline examination system project in jsp thanks for providing me 6 tables for
online examination system. I want to know what will the id field of Answers1 table contain? Will it contain same id for all the questions of Set1 &
online examination system project in jsponline examination system project in jsp Thanks for providing me the 6 tables.But I want to know will the id field of answers1 table be same for all questions of Set1? Will it be 1 or will be 1,2,3,...
What
servlet doubt on online examination systemservlet doubt on
online examination system hai. sir ,i am doing project in
online examination system.
taken back end as mysql database. and doing the programs using java servlet.
MY PROBLEM and doubt is
1. how 2 skip
online examination system project in jsponline examination system project in jsp I am doing project in
online examination system in java server pages.
plz send me the simple source code in jsp for
online examination system
online examination system mini projectonline examination system mini project i developed a project on
online examination system using jsp and java script . I am getting the quetion...;
For more information, visit the following link:
Struts
Online Test Application
On line examination projectOn line
examination project Hi,
I am doing project in jsp,nam eis
online examination project.
I am facing some problems.
In my database several...-Servlet/7578-creation-of-a-form.html
http://www.roseindia.net/jsp/
online-quiz
SECURE EXAMINATION SYSTEMSECURE
EXAMINATION SYSTEM Hello sir,if any
online exam is held then we register with username and password and starts the exam with the question one by one within countdown session that is within timer out.If the system failure
Prometric Centers AND Examination TimingPrometric Centers AND
Examination Timing Please provide me list of prometric centers in mumbai for SCJP and also date & time for the
examination.
Thank You In Adv
create examination slip for studentscreate
examination slip for students hello,can anyone help me how to create
examination slip that include subject code,courses,credit hours,grade ,and status
on-line examination project?(urgent pls)on-line
examination project?(urgent pls) Hello friends,
i am doing an on-line
examination project. In A page i will get n(user requirement) questions from data base(question and five radio buttons) if the user had
online test systemonline test system Hi,
I am creating a project for
online test.../
online-quiz-application-jsp.shtml
http://www.roseindia.net/answers/viewqa/JSP-Servlet/15400-online-
examination-system-project-in-jsp.html
http
online votingonline voting can i have the code for
online voting in java
online votingonline voting can i have the code for
online voting in java
Online exam using c# and SQL serverOnline exam using c# and SQL server hello, i'm making the (window based)
online examination system using C#.net and SQL SERVER. my database is stored on server. my question is: if during the
examination server gets failed
online shoppingonline shopping hi, i am doing
online shopping project i want to do
online payment. How it can be possible
online examonline exam how we can upload the data on the server using any site
online examonline exam how we can upload the data on the server using any site
online shopping online shopping Hai sir/madam,
i'm working on
online shopping project.requirements is oracle10g,servlets/jsp...
what is the difference b/w storing and saving image into database.how to store and how
online examonline exam Write a program to determine if an input string x is a substring of another input string y. For example, a "bat" is a substring of "abate" but not a substring of "beat
Online ExamOnline Exam I want to write a program for Exam with multiple answers
program can read answers one by one and it shows the total marks at the end how it can implement
Help me
Online test Online test I am creating a project for
online test system. There should be a timer,on pressing next button it will retrieve a next question and it will show on the same page,on completion of test it will show result
cs229 online field. I am searching for
the tutorials to learn:
cs229
online
Try... and Data Science
online training course for software developers
What is predictive analytics?
Online TensorFlow 2.0 training course
Thanks
online quizonline quiz Define a Question class which stores a multiple choice question having one correct
answer. Each question has a complexity (difficulty) level. Use the Question class to define a
Quiz class. A quiz can be composed
online quizonline quiz Define a Question class which stores a multiple choice question having one correct answer. Each question has a complexity (difficulty) level. Use the Question class to define a Quiz class. A quiz can be composed
online quizonline quiz Define a Question class which stores a multiple choice question having one correct answer. Each question has a complexity (difficulty) level. Use the Question class to define a Quiz class. A quiz can be composed
online quizonline quiz Define a Question class which stores a multiple choice question having one correct answer. Each question has a complexity (difficulty) level. Use the Question class to define a Quiz class. A quiz can be composed
online quizonline quiz Define a Question class which stores a multiple choice question having one correct answer. Each question has a complexity (difficulty) level. Use the Question class to define a Quiz class. A quiz can be composed
online examonline exam The file geneexpr500x204.gct contains gene expression values for 500 genes (analytes) and 204 samples.
(a) Extract the sample names from the file geneexpr500x204.gct. Save the list (one sample name per line
online quizonline quiz Define a Question class which stores a multiple choice question having one correct answer. Each question has a complexity (difficulty) level. Use the Question class to define a Quiz class. A quiz can be composed
online examonline exam The Government of Byteland has decided to issue new currency notes with special protection features to commemorate their great mathematician Byteguru. Byteland has decided to issue notes using the following rules
online examonline exam The Government of Byteland has decided to issue new currency notes with special protection features to commemorate their great mathematician Byteguru. Byteland has decided to issue notes using the following rules
online examonline exam The Government of Byteland has decided to issue new currency notes with special protection features to commemorate their great mathematician Byteguru. Byteland has decided to issue notes using the following rules