8.With the help of your lecturer, prepare a questionnaire with five multiple choice questions
related to the seminar feedback, from the delegates, which was organized in your college by
your department. The form should accept the name of the delegate, Delegate Type (Student or
Staff), designation (for students, designation should be student) department (for students,
department should be the course in which he/she is studying in), Address and Phone number.
When the feedback is given through this form, the details of the delegate along with the
feedback should be stored in a database table (the choice of database management system is
open except MS-Access).
OUTPUT:
Developers:
1.Manju
2.Sanjay
DELEGATE FORM
DELEGATES INFORMATION:
PAGE 1: Program8.html
DELEGATE FORM
DELEGATES INFORMATION:
PAGE 2:Program8.jsp
DELEGATE DETAILS
<%@ page import="java.sql.*,java.util.*"%>
DELEGATE INFORMATION IS STORED SUCCESSFULLY
<%
String delegatename=request.getParameter("delegatename");
String delegatetype=request.getParameter("delegatetype");
String designation=request.getParameter("designation");
String department=request.getParameter("department");
String address=request.getParameter("address");
String phonenumber=request.getParameter("phonenumber");
out.print("");
out.println("| DELEGATENAME | "+delegatename+" |
");
out.println("| DELEGATETYPE | "+delegatetype+" |
");
out.println("| DESIGNATION | "+designation+" |
");
out.println("| DEPARTMENT | "+department+" |
");
out.println("| ADDRESS | "+address+" |
");
out.println("| PHONENUMBER | "+phonenumber+" |
");
String question1=request.getParameter("question1");
String question2=request.getParameter("question2");
out.println("| q1 | "+question1+" |
");
out.println("| q2 | "+question2+" |
");
out.print("
");
try {
String connectionURL = "jdbc:mysql://localhost:3306/mytestdb";
Class.forName("com.mysql.jdbc.Driver") .newInstance();
Connection connection = DriverManager.getConnection(connectionURL,"root","");
PreparedStatement p=connection.prepareStatement("insert into delegateinfo values('"+delegatename+"','"+delegatetype+"','"+designation+"','"+department+"','"+address+"','"+phonenumber+"')");
int rs=p.executeUpdate();
if(rs>0)
{
out.print("DATA INSERTED SUCCESSFULLY");
}
else
{
out.print(" NOT CONNECTED");
}
if(!connection.isClosed())
out.println("Successfully connected to " + "MySQL server using TCP/IP...");
connection.close();
}
catch(Exception ex){
out.println("Unable to connect to database."+ex);
}
%>