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 of jsp file which i have sent,...,i used next and previous buttons and used two form tags ..,i need to place the next button and previous button side by side,but problem occuring calling servlet...,if place buttons in one row side by side,..,action performing for both button is same ,i mean it will call nextaptiduteservlet action only always,,,if i take of the form tag of preservlet out of table ...,both buttons works properly .....,so i want a solution for placing the two buttons side by side and the action should be performed properly......,
View Answers
July 30, 2012 at 11:46 AM
Here is a jsp application. Here we have created a table test(ques,op1,op2,op3,op4,ans) and answers(id,ans).
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");
%>
Ads
Related Tutorials/Questions & Answers:
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
Advertisements
Using Servlets, JSP for Online Shopping
Using Servlets,
JSP for
Online Shopping What is wrong with my code ?
JSP
<form action="LoginServlet "method="post" >
<table>
<tr ><td>Username:</td><td><input type="text" name="Id
Register page using servlets,jsp and java beans
Register page
using servlets,
jsp and
java beans i want code for register page
using jsp,serlets and
java beans.iam getting error for my code in
java...://www.roseindia.net/
jsp/user-registration-form-
using-jsp.shtml
Thanks
online test project
online test project i need
online test project in
java using struts...kindly help..
Have a look at the following link:
http://www.roseindia.net/struts/struts/struts2.2.1/onlinetestapp
Online Test System Project
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...://www.roseindia.net/
jsp/
online-quiz-application-jsp.shtml
Online Test System Project
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 as mysql. my email address is help me. send a full
project on
online test system
java servlets - JSP-Servlet
java servlets how to get the parameter value of input type file
using java servlets Hi,
You can use request.getParameter().
In
Jsp,
---
---
IN servlet,
String fileName=request.getParameter('fl');
If you
online examination system project in jsp
online 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 jsp
online 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
using jsp and servlets andin Mvc architecture
using jsp and
servlets andin Mvc architecture how to insert a form data in different tables, that means education details in education table, address details in address table,like that and finally if we fetch all must come
online examination system project in jsp
online 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 jsp
online 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 jsp
online 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
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
Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with
JSP &
Servlets.
 ... acceres the MYSQL
database. Here I am
using MYSQL & tomcat server...=password
Typing help on the mysql prompt shows
online
help
online test application in java
online test application in java Can questions come in html file (test.html) if we link test.jsp with test.html
We have taken... the following link:
http://www.roseindia.net/
jsp/
online-quiz-application-jsp.shtml
online shopping project
online shopping project sir,
plz can u send me the coding of simple application of
online shopping cart
project using jsp and
servlets which should be run in netbeans without any errors
jsp -servlets
jsp -servlets i have
servlets s1 in this
servlets i have created emplooyee object, other
servlets is s2, then how can we find employee information in s2
servlets
Online test
Online test I am creating a
project for
online test system... and it will show on the same page,on completion of
test it will show result and that result will also store in the database.The code must be in
JSP-SERVLET
using