Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

Aim of the Micro Project/Problem Statement

In order to take any decision in an organization, it is essential to know


what actually workers or the members of organization want. It may not
possible to listen to everybody separately and sometimes the viewpoints
are required to be kept secret. Also, the manual system of survey is
tedious and time consuming as well as uneconomical. So, an online
survey system is the solution of these existing problems.
The main aim of the micro project is to make an online survey system
using Java and to study java in web application.

Course Outcomes Integrated

Developed an Online Survey System.

Proposed Methodology

First, we studied and tried to understand What is Survey System? What


are the problems in regular survey system? and their drawbacks. Then
we decided to develop a online survey system for multiple surveys. After
that finally we finished development of our online survey system.

Action Plan

Sr. Details Planned Start Date Planned Finish


Date
No

1 Selection of 20/10/2020 20/10/2020


Topic
2 Topic Research 26/10/2020 30/10/2020

3 Implementation 05/11/2020 11/11/2020


Resources Required

Sr. Name of Specification Qty Remarks


Resource /
No Material
1 Windows Pc Intel core i-5 1 _

2 Microsoft Word 2016 1 _

3 Tomcat Server v 8.5 1 -

4 My SQL v 3.2 1 -
Database
5 Chrome Browser v 80.0 1 -

INDEX

SR.NO. CONTENT PAGE NO.

1 TITLE OF THE PROJECT 1

2 CERTIFICATES 2-3

3 GROUP DETAILS 4

4 PROGRAM (CODE) 8-19

5 PROGRAM (OUTPUTS) 20-29

6 CONCLUSION 30
EVALUATION SHEET

7 31-32

Program (Code):

1. Program to fetch Contact us details from database and


display in tabular form for admin only.

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


<%
try{
response.setContentType("text/html");
Class.forName("com.mysql.jdbc.Driver")
;
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root",""); if(!conn.isClosed())
{
PreparedStatement ps = conn.prepareStatement("select * from
contactus");
ResultSet rs = ps.executeQuery();
%>
<html>
<body>
<link rel='stylesheet' type = 'text/css' href = 'main.css'>
<nav>
<label>Online Survey System</label>
<ul>
<li><a href='index.html'>Home</a></li>
<li><a href='admin.html'>Admin</a></li>
<li><a href='user.html'>User</a></li>
<li><a href='contactus.html'>Contact us</a></li>
<li><a href='feedback.html'>Feedback</a></li>
</ul>
</nav>
<table border='2' class='admintable'>
<tr class='row'>
<td>User Name</td>
<td>Email</td>
<td>Phone number</td>
<td>Message</td>
</tr>
<%
while(rs.next())
{
out.println("<tr><td>"+ rs.getString(1)+"</td>
<td>"+ rs.getString(2)+"</td> <td>"+
rs.getString(3)+"</td> <td>"+
rs.getString(4)+"</td></tr>");
}
%>
</table>
</body>
</html>
<%
}

}catch(Exception e)
{ out.println(e);
}
%>

2.Program to fetch Feedback details from database and display


in tabular form for admin only.

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


<%
try{
response.setContentType("text/html");
Class.forName("com.mysql.jdbc.Driver")
;
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root",""); if(!conn.isClosed())
{
PreparedStatement ps = conn.prepareStatement("select * from
feedback");
ResultSet rs = ps.executeQuery();
%>
<html>
<body>
<link rel='stylesheet' type = 'text/css' href = 'main.css'>
<nav>
<label>Online Survey System</label>
<ul>
<li><a href='index.html'>Home</a></li>
<li><a href='admin.html'>Admin</a></li>
<li><a href='user.html'>User</a></li>
<li><a href='contactus.html'>Contact us</a></li>
<li><a href='feedback.html'>Feedback</a></li>
</ul>
</nav>
<table border='1' class='admintable'>
<tr class='row'>
<td>User Name</td>
<td>Email</td>
<td>Message</td>
<td>Rating</td> </tr>
<%
while(rs.next())
{
out.println("<tr><td>"+ rs.getString(1)+"</td>
<td>"+ rs.getString(2)+"</td> <td>"+
rs.getString(3)+"</td> <td>"+
rs.getString(4)+"</td></tr>");
}
%>
</table>
</body>
</html>
<%
}
}catch(Exception e)
{ out.println(e);
}
%>

3.Program to add questions with options and question id in


database from add question form for admin only.

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


<%
String questionID =request.getParameter("questionID");
String question =request.getParameter("question");
String optionA =request.getParameter("optionA");
String optionB =request.getParameter("optionB");
String optionC =request.getParameter("optionC");
String optionD =request.getParameter("optionD");

try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root","");
PreparedStatement ps = conn.prepareStatement("insert into
questions(questionID, question, optionA, optionB, optionC,
optionD) values(?,?,?,?,?,?)"); ps.setString(1,questionID);
ps.setString(2,question); ps.setString(3,optionA);
ps.setString(4,optionB); ps.setString(5,optionC);
ps.setString(6,optionD); int x = ps.executeUpdate();
if(x>0){
out.println("Question has been added Sucessfully!!!!");
}else{
out.println("Question Failed to be uploaded");
}
}catch(Exception e)
{ out.println(e);
}
%>
4.Program to fetch question with options from database as per
given question id by the user.

<%@page contentType="text/html" pageEncoding="UTF-8"%>


<%@page import="java.sql.*" %>
<div class="container">
<div>
<%
Connection con;
PreparedStatement pst;
ResultSet rs;
String qid="";
String question="";
Class.forName("com.mysql.jdbc.Driver");
con =
DriverManager.getConnection("jdbc:mysql://localhost/survey","root","");
String questionID = request.getParameter("qid");
pst = con.prepareStatement("select * from questions where
questionID =?");
pst.setString(1,
questionID); rs =
pst.executeQuery();
%>
<html>
<head>
<title>Quiz Page</title>
<link rel='stylesheet' type ='text/css' href = 'main.css'>
</head>
<body>
<nav>
<label>Online Survey System</label>
<ul>
<li><a href='index.html'>Home</a></li>
<li><a href='admin.html'>Admin</a></li>
<li><a href='contactus.html'>Contact us</a></li>
<li><a href='feedback.html'>Feedback</a></li>
</ul>
<table border='2' class='admintable'>
<tr class='row'> <td>Question ID</td>
<td>Question</td> <td>Option A</td> <td>Option B</td> <td>Option
C</td>
<td>Option D</td></tr>
<% while(rs.next())
{

qid = rs.getString("questionID");
question = rs.getString("question");
%>
<TD><%= qid %></TD>
<TD ><%= question %> </TD>
<TD><%= rs.getString("optionA") %></TD>
<TD><%= rs.getString("optionB") %></TD>
<TD><%= rs.getString("optionC") %></TD>
<TD><%= rs.getString("optionD") %></TD>
<%
}
%>
</Table>
<center>
<form action="response.jsp" method="post">

<input type="hidden" name="qid" value=<%= qid %>


></input>
<input type="hidden" name="question" value='<%=
question
%>' > </input>
<h3>Enter Your Full Name:-</h3>
<input type="text" class="search" name="name"
required=""/><br><br>
<h3>Enter Your Option here:-</h3>
<input type="text" class="search" name="answer"
required=""/><br><br>
<input type="submit" class="submit" />
</form>
</center>
</div>
</div>
</body>
</html>

5.Program to insert name and answer given by the user along with
question and question id in the database.

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


<%
String questionID = request.getParameter("qid");
String question = request.getParameter("question");
String name = request.getParameter("name");
String answer = request.getParameter("answer");

try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root","");
PreparedStatement ps =
conn.prepareStatement("insert into
results(questionID,question,name,answer)
values(?,?,?,?)"); ps.setString(1,questionID);
ps.setString(2,question); ps.setString(3,name);
ps.setString(4,answer);

int x = ps.executeUpdate();

if(x > 0){


out.println("Done Successfully...!!");
}
else{
out.println("Failed...");
}

}catch(Exception e)
{ out.println(e);
}
%>
6.Program to fetch result for answers given by the user from
database and display in tabular form only for admin.

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


<%
try{
response.setContentType("text/html");
Class.forName("com.mysql.jdbc.Driver")
;
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root",""); if(!conn.isClosed())
{
PreparedStatement ps = conn.prepareStatement("select * from
results");
ResultSet rs = ps.executeQuery();
%>
<html>
<body>
<link rel='stylesheet' type = 'text/css' href = 'main.css'>
<nav>
<label>Online Survey System</label>
<ul>
<li><a href='index.html'>Home</a></li>
<li><a href='admin.html'>Admin</a></li>
<li><a href='user.html'>User</a></li>
<li><a href='contactus.html'>Contact us</a></li>
<li><a href='feedback.html'>Feedback</a></li>
</ul>
</nav>
<table border='1' class='admintable'>
<tr class='row'>
<td>Question Id</td>
<td>Question</td>
<td>Name of the Person</td>
<td>Answer</td> </tr>
<%
while(rs.next())
{
out.println("<tr><td>"+ rs.getString(1)+"</td>
<td>"+ rs.getString(2)+"</td> <td>"+
rs.getString(3)+"</td> <td>"+
rs.getString(4)+"</td></tr>");
}
%>
</table>
</body>
</html>
<%
}
}catch(Exception e)
{ out.println(e);
}
%>

7.Program to insert Contact us data in database

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


<%
String uname = request.getParameter("uname");
String emailid = request.getParameter("emailid");
String phonenumber = request.getParameter("phonenumber");
String message = request.getParameter("message");

try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root","");
PreparedStatement ps = conn.prepareStatement("insert
into contactus(fullname,email,phonenumber,message)
values(?,?,?,?)"); ps.setString(1,uname);
ps.setString(2,emailid); ps.setString(3,phonenumber);
ps.setString(4,message);

int x = ps.executeUpdate();
if(x > 0){
out.println("Done Successfully...!!");
}
else{
out.println("Failed...");
}

}catch(Exception e)
{ out.println(e);
}

%>

8.Program to insert feedback data in database

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


<%
String uname = request.getParameter("uname");
String emailid = request.getParameter("emailid");
String message = request.getParameter("message");
String rating = request.getParameter("rating");

try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
survey","root","");
PreparedStatement ps =
conn.prepareStatement("insert into
feedback(uname,email,message,rating)
values(?,?,?,?)"); ps.setString(1,uname);
ps.setString(2,emailid); ps.setString(3,message);
ps.setString(4,rating);
int x = ps.executeUpdate();
if(x > 0){
out.println("Done Successfully...!!");
}
else{
out.println("Failed...");
}catch(Exception e){ out.println(e); } %>
Program (Outputs) :
1.Home Page

2.Survey Page (User must enter Question Id)


4.Quiz Page (After Submitting Answer)

5.Admin Page
(Before Login)

6.Admin Page (After Login)

7.Result Page (Only Accessible for Admin)


8.Add Question Page (Only Accessible for Admin)

9. Success Message (After Adding Question)


10.User Data (Contact us and Feedback for Admin only)

11.User Contact us Data (Only Accessible for Admin)

12. User Feedback Data (Only Accessible for Admin)


13.Contact us Page

14. Success Message (After Submitting Contact us data)

15.Feedback Page

16. Success Message (After Submitting Feedback data)


17. Questions Database

18. Result Page


19. Contact us Database

20. Feedback Database

Conclusion:
In conclusion, Online Survey System Project in Java is an
excellent software to conduct online survey with minimized
economy. The result of the project is accurate and totally error
free. With this system, the whole survey process can be
conducted Online. The growing use of internet and computers
confirms the good scopes of project.

You might also like