Home Answers Viewqa JSP-Servlet Need Help in creating online quiz application using JSP

 
 


ganesh
Need Help in creating online quiz application using JSP
3 Answer(s)      4 years and 6 months ago
Posted in : JSP-Servlet

View Answers

November 21, 2008 at 7:13 AM


Hi friend,


<%@ page import="java.sql.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">;

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String ans=" ";
if(request.getParameter("correctAns")!=null)
{
ans=request.getParameter("correctAns").toString();
}


Connection conn = null;
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String user = "amar";
String pass = "amar123";
Statement st = null;
ResultSet qrst;
ResultSet rs = null;

String id=request.getParameter("id");

System.out.println("id:"+id);

int i=1;

String s,g;

int count=0;

try {

Class.forName(driver);
conn = DriverManager.getConnection(url+db,user,pass);

st = conn.createStatement();
//for(i=1;i<=2;i++)
// {
rs = st.executeQuery("select * from question_deatil");

while(rs.next()) {
%>

<br>
<br/>
<center>

<table border="1" width="500px" bgcolor="pink" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">

<form name="form1">

<h2 align="center"><font color="red">Online Quize Application</font></h2>

<b>Select Correct Answer</b>
<table border="0" width="500px" cellspacing="2" cellpadding="4">
<tr>

<td width="50%"> Question:</td>
<input type="hidden" name="correctAns" value="<%=rs.getString(7)%>" />
<tr>
<td><%= rs.getString("quest") %></td></tr>
<tr>
<td>

1: <input type="radio" name="a" value= "QA" /></td>
<td><%= rs.getString("QA") %></td></tr>
<tr>
<td>
2: <input type="radio" name="a" value="QB" /></td>
<td><%= rs.getString("QB") %></td></tr>

<tr>
<td>
3: <input type="radio" name="a" value="QC" /></td>
<td><%= rs.getString("QC") %> </td></tr>

<tr>
<td>
4: <input type="radio" name="a" value="QD" /> </td>
<td> <%= rs.getString("QD") %> </td></tr>

<tr>
<td>
<center>
<input type="submit" value="Submit" name="submit"></center></td></tr>
</table>

</form>
</td>
</tr>
</table>
</center>
</body>
<% g=request.getParameter("a");
%>
<%
if(g.equals(ans)){

count++;
out.println("Correct");

}
else
out.println("false");
%>



<%
}}
// }
catch (Exception ex) {
ex.printStackTrace();


%>

<%
} finally {
if (rs != null) rs.close();
if (st != null) st.close();
if (conn != null) conn.close();
}
out.println("Score="+count);
%>

</html>

November 21, 2008 at 7:15 AM


<%@page language="java" import="java.sql.*" %>



<%
if(request.getParameter("submit")!=null)
{

Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String pass="amar123";



try{

Class.forName(driver);

con = DriverManager.getConnection(url+db,userName,pass);



try{

Statement st = con.createStatement();

String quest = request.getParameter("quest").toString();
String QA = request.getParameter("QA").toString();
String QB = request.getParameter("QB").toString();
String QC = request.getParameter("QC").toString();
String QD = request.getParameter("QD").toString();
String correctAns = request.getParameter("correctAns").toString();
out.println("quest : " + quest);

String qry = "insert into question_deatil(quest,QA,QB,QC,QD,correctAns) values('"+quest+"','"+QA+"','"+QB+"','"+QC+"','"+QD+"','"+correctAns+"')";

out.println("qry : " + qry);



int val = st.executeUpdate(qry);

con.close();
if(val>0)
{
response.sendRedirect("quizeApplication.jsp");
}



}



catch(SQLException ex){

System.out.println("SQL satatment not found");

}

}

catch(Exception e){

e.printStackTrace();

}
}


%>

November 21, 2008 at 7:16 AM



<html>
<title>Quize application in jsp</title>
<head>

<script>

function validateForm(theForm){



if(theForm.quest.value==""){

//Please enter username

alert("Please enter Question.");

theForm.quest.focus();

return false;

}

return true;
}
</script>
</head>

<body>
<br>
<br/>
<center>

<table border="1" width="450px" bgcolor="pink" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<form method="POST" action="" onsubmit="return validateForm(this);">

<h2 align="center"><font color="red">Quize Application in JSP</font></h2>
<table border="0" width="400px" cellspacing="2" cellpadding="4">
<tr>
<td width="50%"><b>Enter Question:</b></td>
<td width="50%"><input type="text" name="quest" size="40"/> </td>
</tr>
<tr>
<td width="50%"><b>Enter Answer(A.):</b></td>
<td width="50%"><input type="text" name="QA" size="40"/> </td>
</tr>
<tr>
<td width="50%"><b>Enter Answer(B.):</b></td>
<td width="50%"><input type="text" name="QB" size="40"/> </td>
</tr>

<tr>
<td width="50%"><b>Enter Answer(C.):</b></td>
<td width="50%"><input type="text" name="QC" size="40"/> </td>
</tr>

<tr>
<td width="50%"><b>Enter Answer(D.):</b></td>
<td width="50%"><input type="text" name="QD" size="40"/> </td>
</tr>

<tr>
<td width="50%"><b>Correct Answer:</b></td>
<td width="50%"><input type="text" name="correctAns" size="10"/> </td>
</tr>

</table>
<center>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>
</center>
</form>
</td>
</tr>
</table>
</center>
</body>

</html>

--------------------------------

Read for more information.

http://www.roseindia.net/jsp/

Thanks.









Related Pages:
Need Help in creating online quiz application using JSP - JSP-Servlet
Need Help in creating online quiz application using JSP  Hi, i am creating online Quiz application using JSP and MySQl ,Apache 6 in Netbeans IDE. i..., JSP Page Online Quize Application
Failed to run Online Quiz Application in JSP - JSP-Interview Questions
Failed to run Online Quiz Application in JSP   Hi, I have been following your following link to run the online quiz application, but I failed... your question. Thanks  Hi, I cannot run your online quiz
Online Quiz Application in JSP
are going to implement of Online quiz application using of JSP. Step 1: Create... Online Quiz Application in JSP  ... quiz question and answer form using with JSP or JDBC database.  Here
JAVASCRIPT FOR ONLINE QUIZ
JAVASCRIPT FOR ONLINE QUIZ  i m creating a set of online questionnaire consist of 12 questions with choice of answers from 0-6.i've done creating... to modify to include get element id function.I REALLY NEED YOUR HELP IN THIS.PLS
Online quiz mini project
Online quiz mini project  Sir i need a online quiz program coding using java servlet, jdbc odbc connection with ms. access. If possible send that source code to me. Thank you
online quiz
online quiz  Define a Question class which stores a multiple choice...) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method of the Quiz class to add a question
How to provide navigation in quiz application using jsp?
How to provide navigation in quiz application using jsp?  hi everyone. i am using jsp with mysql connectivity. i have to retrieve questions from db one at a time. on clicking the next it should go the next question
How to Create Quiz Application using iPhone
How to Create Quiz Application using iPhone  Hi, I am learning iphone application Programming Language. my question is that how to create a quiz application using iPhone. Please provide online reference to study and example
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.  please provide online quiz program coding using jsp, jdbc...: http://www.roseindia.net/jsp/online-quiz-application-jsp.shtml
problem in creating web application using servelet, jsp, jdbc and xml - JSP-Servlet
problem in creating web application using servelet, jsp, jdbc and xml  Using Servlet, JSP, JDBC and XML create a web application for a courrier company to provide online help in tracking the delivery status of items.  
online banking application
online banking application  i want to develope online banking application by using jsp with oracle 10g database but i have problem to view the mini... this ... plz send coding in jsp by using oracle 10g database
Need help
Need help  Dear sir, I have a problem. How to write JSP coding.... This name list should get from the database. Please help me. By the way, I'm using access database and jsp code. Thank you
need help creating a lift program - Java Beginners
need help creating a lift program  Classes, Methods, Constructors please i need help to create an elevator program Simulating an Elevator write... and how methods manipulate the data of an object. 1. Using (JCreator), write
need help...................please
need help...................please  I have a problem in my JSP Coding... on this area. Please help me. By the way, I'm using access Database and JSP coding. Thank You.   Here is an application that retrieves table name from
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have... using JAVA JSP). e.g. Tool does not adjust with the resolution of the screen(need to know how I can adjust it based on the cureen system's screen resolution
Online Test System Project
on online test system in jsp. i am not using servlet but only jsp.And backend database as mysql. my email address is help me. send a full project on online test system.../online-quiz-application-jsp.shtml   Many many thanks for the reply
online quiz
online quiz  Define a Question class which stores a multiple choice...) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method of the Quiz class to add a question
online quiz
online quiz  Define a Question class which stores a multiple choice...) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method of the Quiz class to add a question
online quiz
online quiz  Define a Question class which stores a multiple choice...) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method of the Quiz class to add a question
online quiz
online quiz  Define a Question class which stores a multiple choice...) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method of the Quiz class to add a question
online quiz
online quiz  Define a Question class which stores a multiple choice...) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method of the Quiz class to add a question
quiz
quiz  using core java concepts purely not html ,Define a Question... question has a complexity (difficulty) level. Use the Question class to define a Quiz class. A quiz can be composed of up to 10 questions. Define the add method
iPhone Quiz App Tutorial
iPhone Quiz App Tutorial In this simple iPhone quiz application tutorial, we are going to learn how to create simple quiz in iphone. Creating a simple... application. Steps to Create a Simple Quiz Application in iPhone Step 1 Create
how to create chat application in jsp?
Creating Chat application in JSP  Creating Chat application in JSP i am developing online web portal using jsp, i need to communicate with admin, so i need integrate with the chat applicaion through the webportal
online test project on java using servlets and jsp
online test project on java using servlets and jsp  as i am doing online test project on java using jsp and servlets ,,,the problem is in the code...;Here is a jsp application. Here we have created a table test
online test application in java
the following link: http://www.roseindia.net/jsp/online-quiz-application-jsp.shtml...online test application in java  Can questions come in html file... radiobuttons in our application, you can take textarea, textfield etc. Here we have created
Online Test System Project
://www.roseindia.net/jsp/online-quiz-application-jsp.shtml...Online Test System Project  I want a full ready-made project on online test system in jsp. i am not using servlet but only jsp.And backend database
online test system
/online-quiz-application-jsp.shtml http://www.roseindia.net/answers/viewqa/JSP...online test system  Hi, I am creating a project for online test... result and that result will also store in the database.The code must be in JSP
need help please
need help please  Dear sir, my name is logeswaran. I have a big... enter a page second time. Please help me. By the way I'm using Access database and JSP coding Thank you
need to open a file that is in server using jsp
need to open a file that is in server using jsp   im doing a web application where i can upload and download pdf files from server.in this i created... open link it should be opened in jsp.downlaoding part was done by me. wt i need
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer...) Write an application that computes the value of ex by using the formula ex = 1... (for n=0) for example, 5!=5.4.3.2.1, which is 120 a) Write an application
jsp online ex
jsp online ex  plz help me providing source code for mini project online exam using jsp and mysql..... plzplz plzhelp me pur
JSTL Tutorials and Online Training
without using scriptlets. This JSTL Online training at RoseIndia.Net will help... with the JSTL - Java Standard Tag Libraries. JSTL online tutorial will help you... are going to create application that execute sql query given by user using JSTL
beginner need help with online ordering program please
beginner need help with online ordering program please  I have created a program for an online ordering system and now have to add error handling and a few other things my teacher doesn't teach well is there a template I can go
jsp online ex
jsp online ex  deepak sir please help me...i jave created jsp page containing a question with 4 optipns and now i want tp save the options selected... help me out plzzzzzzzzzzz i need it urgently
Need some help creating an order form.
Need some help creating an order form.  Hi there. I am looking to create an order form for clients to customize the way a product looks. The codes I found on the form html page are useful. My question is: can I tie them all
Need help with this!
Need help with this!  Can anyone please help me... to a file at all at this time. Any help would be greatly appreciated, thank you...)); //creating arrays int [][] score = new int[27][50]; int
need help to remove and optimise the code for creating a page
need help to remove and optimise the code for creating a page   i have the following code but it has some sorts of error whenever i run the page after validation through javascript it calls for the servlets and then i tried
online book store by using MVC architecture
online book store by using MVC architecture  Tarzan book store decided to go online to increase itsā?? revenues and provide itsā?? customers a way..., OS, self help etc.), price and quantity. Anybody can log on to the website
Need help to create Struts 2 MySQL based HRMS application.
Need help to create Struts 2 MySQL based HRMS application.   Hi Sir, I am doing my project based on Human Resource Management system using struts 2... given here. Some are working but some are not. Can you please help me to create
need
need  i need a jsp coding based project plz help me
online examination
: http://www.roseindia.net/jsp/online-quiz-application-jsp.shtml...online examination  coding for multiple choice question in jsp   We are providing you a simple application. Create table test
struts problem ... need help urgently.. please reply ASAP
struts problem ... need help urgently.. please reply ASAP  Hi Every1, I want to make an application using struts 1.2. I am a beginner on struts. Dont know much about struts. In application I have to make jsp to get some
how to create chat application in jsp?
how to create chat application in jsp?  i am developing online web portal using jsp, i need to communicate with admin, so i need integrate with the chat applicaion through the webportal
Creating Views
Creating Views Struts provides their own JSP tag library for creating view. For using those library you need to import them on your page as <%@taglib... data by model and handle them appropriately. For creating a view you should
online test application in java
Online Test Application Table Of Contents Introduction To Application Database Design Creating Data Access Object (DAO) Design Pattern Creating Views Writing Actions Mapping Application Admin Module User Module Download
creating a java bean application - IDE Questions
creating a java bean application  hi, i want to create a java bean using BDK. please tell me all the steps for creating a simple java bean application. i have also a confusion about the properties of java bean. please explain
i want to do a project using jsp and servlet....What are all the materials i need to study
need to study   i want to do a project using jsp and servlet....What... links: JSP shopping cart Struts Shopping Cart Struts Online test application JSP Online test application   Please visit the following links: JSP
Probem while creating PDF through JSP-Servlet - JSP-Servlet
Probem while creating PDF through JSP-Servlet  Hi, I have a web-app in which I want to convert MS-Office documents to PDF online. I'm using... java app or the batch file through JSP or servlet the PDFCreator is called but I
New to JSP..need help to make & run a JSP program.
New to JSP..need help to make & run a JSP program.  Hi, I have installed Tomcat 5.5 on my system. Plz help me to make a simple JSP program... appropriate name to web application folder like examples and put jsp file

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.