├── src ├── conf │ └── MANIFEST.MF └── java │ ├── update_faculty_details.java │ ├── delete_notice.java │ ├── f_to_s.java │ ├── update_faculty_password.java │ ├── s_to_f.java │ ├── total_lectures.java │ ├── update_faculty_fname.java │ ├── update_faculty_lname.java │ ├── update_faculty_uname.java │ ├── update_student_fname.java │ ├── update_student_lname.java │ ├── update_student_uname.java │ ├── update_student_password.java │ ├── fetch_faculty_details.java │ ├── fetch_student_details.java │ ├── enrollFaculty.java │ ├── update_marks.java │ ├── enrollStudent.java │ ├── register_course.java │ ├── update_attendance.java │ ├── courseRegister.java │ ├── upload_notice.java │ └── login.java ├── web ├── images │ ├── animal.jpg │ ├── minus.jpg │ └── plus.jpg ├── WEB-INF │ └── glassfish-web.xml ├── faculty_chat.jsp ├── js │ ├── jQuery-plugin-progressbar.css │ └── jQuery-plugin-progressbar.js ├── faculty_home.jsp ├── faculty_notice.jsp ├── update_faculty_image.jsp ├── see_notices.jsp ├── see_student_notice.jsp ├── update_admin_image.jsp ├── index.jsp ├── new_faculty_message.jsp ├── new_student_message.jsp ├── faculty_details.jsp ├── styles.css ├── student_details.jsp ├── faculty_marks.jsp ├── update_faculty_details.jsp ├── faculty_attendance.jsp ├── notices.jsp ├── update_student_image.jsp ├── student_marks.jsp └── student_home.jsp ├── dist └── Student_Management_System.war ├── nbproject ├── customs.json ├── genfiles.properties ├── private │ ├── private.properties │ └── private.xml └── project.xml └── README.md /src/conf/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | 3 | -------------------------------------------------------------------------------- /web/images/animal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjain5164/Student_Management_System/HEAD/web/images/animal.jpg -------------------------------------------------------------------------------- /web/images/minus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjain5164/Student_Management_System/HEAD/web/images/minus.jpg -------------------------------------------------------------------------------- /web/images/plus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjain5164/Student_Management_System/HEAD/web/images/plus.jpg -------------------------------------------------------------------------------- /dist/Student_Management_System.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjain5164/Student_Management_System/HEAD/dist/Student_Management_System.war -------------------------------------------------------------------------------- /nbproject/customs.json: -------------------------------------------------------------------------------- 1 | { 2 | "elements": {}, 3 | "attributes": { 4 | "canvas": { 5 | "context": "script" 6 | }, 7 | "resize": { 8 | "context": "canvas" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=2695b98b 2 | build.xml.script.CRC32=d14451d3 3 | build.xml.stylesheet.CRC32=651128d4@1.77.1.1 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=2695b98b 7 | nbproject/build-impl.xml.script.CRC32=bc0a57e0 8 | nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.77.1.1 9 | -------------------------------------------------------------------------------- /web/WEB-INF/glassfish-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /Student_Management_System 5 | 6 | 7 | 8 | Keep a copy of the generated servlet class' java code. 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | deploy.ant.properties.file=C:\\Users\\Harsh Jain\\AppData\\Roaming\\NetBeans\\8.2\\config\\GlassFishEE6\\Properties\\gfv3633789241.properties 2 | j2ee.platform.is.jsr109=true 3 | j2ee.server.domain=C:/Users/Harsh Jain/AppData/Roaming/NetBeans/8.2/config/GF_4.1.1/domain1 4 | j2ee.server.home=C:/Program Files/glassfish-4.1.1/glassfish 5 | j2ee.server.instance=[C:\\Program Files\\glassfish-4.1.1\\glassfish;C:\\Program Files\\glassfish-4.1.1\\glassfish\\domains\\domain1]deployer:gfv3ee6wc:localhost:4848 6 | j2ee.server.middleware=C:/Program Files/glassfish-4.1.1 7 | javac.debug=true 8 | javadoc.preview=true 9 | selected.browser=Chrome 10 | user.properties.file=C:\\Users\\Harsh Jain\\AppData\\Roaming\\NetBeans\\8.2\\build.properties 11 | -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file:/C:/Users/Harsh%20Jain/Documents/NetBeansProjects/Student%20Management%20System/src/java/s_to_f.java 7 | file:/C:/Users/Harsh%20Jain/Documents/NetBeansProjects/Student%20Management%20System/web/chat_faculty.jsp 8 | file:/C:/Users/Harsh%20Jain/Documents/NetBeansProjects/Student%20Management%20System/src/java/f_to_s.java 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /web/faculty_chat.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : faculty_chat 3 | Created on : 17 Sep, 2018, 9:10:50 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | Chat Room 13 | 14 | 15 | 16 |
17 |
ABC Insitute
19 |
20 | 30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /web/js/jQuery-plugin-progressbar.css: -------------------------------------------------------------------------------- 1 | body { background-color:#ECF0F1;} 2 | .position { 3 | float: left; 4 | margin: 100px 20px; 5 | } 6 | 7 | .progress-bar { 8 | position: relative; 9 | height: 200px; 10 | width: 200px; 11 | } 12 | 13 | .progress-bar div { 14 | position: absolute; 15 | height: 200px; 16 | width: 200px; 17 | border-radius: 50%; 18 | } 19 | 20 | .progress-bar div span { 21 | position: absolute; 22 | font-family: Arial; 23 | font-size: 25px; 24 | line-height: 175px; 25 | height: 175px; 26 | width: 175px; 27 | left: 12.5px; 28 | top: 12.5px; 29 | text-align: center; 30 | border-radius: 50%; 31 | background-color: white; 32 | } 33 | 34 | .progress-bar .background { background-color: #b3cef6; } 35 | 36 | .progress-bar .rotate { 37 | clip: rect(0 100px 200px 0); 38 | background-color: #4b86db; 39 | } 40 | 41 | .progress-bar .left { 42 | clip: rect(0 100px 200px 0); 43 | opacity: 1; 44 | background-color: #b3cef6; 45 | } 46 | 47 | .progress-bar .right { 48 | clip: rect(0 100px 200px 0); 49 | transform: rotate(180deg); 50 | opacity: 0; 51 | background-color: #4b86db; 52 | } 53 | @keyframes 54 | toggle { 0% { 55 | opacity: 0; 56 | } 57 | 100% { 58 | opacity: 1; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /web/js/jQuery-plugin-progressbar.js: -------------------------------------------------------------------------------- 1 | ; 2 | (function ($) { 3 | $.fn.loading = function () { 4 | var DEFAULTS = { 5 | backgroundColor: '#b3cef6', 6 | progressColor: '#4b86db', 7 | percent: 75, 8 | duration: 2000 9 | }; 10 | 11 | $(this).each(function () { 12 | var $target = $(this); 13 | 14 | var opts = { 15 | backgroundColor: $target.data('color') ? $target.data('color').split(',')[0] : DEFAULTS.backgroundColor, 16 | progressColor: $target.data('color') ? $target.data('color').split(',')[1] : DEFAULTS.progressColor, 17 | percent: $target.data('percent') ? $target.data('percent') : DEFAULTS.percent, 18 | duration: $target.data('duration') ? $target.data('duration') : DEFAULTS.duration 19 | }; 20 | // console.log(opts); 21 | 22 | $target.append('
' + opts.percent + '%
'); 23 | 24 | $target.find('.background').css('background-color', opts.backgroundColor); 25 | $target.find('.left').css('background-color', opts.backgroundColor); 26 | $target.find('.rotate').css('background-color', opts.progressColor); 27 | $target.find('.right').css('background-color', opts.progressColor); 28 | 29 | var $rotate = $target.find('.rotate'); 30 | setTimeout(function () { 31 | $rotate.css({ 32 | 'transition': 'transform ' + opts.duration + 'ms linear', 33 | 'transform': 'rotate(' + opts.percent * 3.6 + 'deg)' 34 | }); 35 | },1); 36 | 37 | if (opts.percent > 50) { 38 | var animationRight = 'toggle ' + (opts.duration / opts.percent * 50) + 'ms step-end'; 39 | var animationLeft = 'toggle ' + (opts.duration / opts.percent * 50) + 'ms step-start'; 40 | $target.find('.right').css({ 41 | animation: animationRight, 42 | opacity: 1 43 | }); 44 | $target.find('.left').css({ 45 | animation: animationLeft, 46 | opacity: 0 47 | }); 48 | } 49 | }); 50 | } 51 | })(jQuery); -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.web.project 4 | 5 | 6 | Student Management System 7 | 1.6.5 8 | 9 | 10 | ${file.reference.com.mysql.jdbc_5.1.5.jar} 11 | WEB-INF/lib 12 | 13 | 14 | ${file.reference.commons-fileupload-1.3.3.jar} 15 | WEB-INF/lib 16 | 17 | 18 | ${file.reference.commons-fileupload-1.3.3-javadoc.jar} 19 | WEB-INF/lib 20 | 21 | 22 | ${file.reference.commons-fileupload-1.3.3-sources.jar} 23 | WEB-INF/lib 24 | 25 | 26 | ${file.reference.commons-fileupload-1.3.3-test-sources.jar} 27 | WEB-INF/lib 28 | 29 | 30 | ${file.reference.commons-fileupload-1.3.3-tests.jar} 31 | WEB-INF/lib 32 | 33 | 34 | ${file.reference.commons-io-2.6.jar} 35 | WEB-INF/lib 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Student_Management_System 2 | 3 | This web application is very well suited for a small institution, coaching and training centres. 4 |
The application has three modules : 5 | - Admin or Owner of the institute 6 | - Faculty Module 7 | - Student Module 8 | 9 | ## How to install and run the project 10 | 11 | - First download and install the latest version of Netbeans IDE. 12 | - Create the databases as given in the files. 13 | - Then simply run the project by clicking the Run button in the IDE. 14 | - Use the screenshots and gifs given below for better understanding of the project. 15 | 16 | ## Technologies used in this project' 17 | - JSP / Servlet 18 | - HTML , CSS and Javascript 19 | - MySQL (for database) 20 | 21 | ## Screenshots and GIFs 22 | 23 | ## 1. Student Module 24 | 25 | #### - Student Login 26 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/first.gif) 27 | 28 | 29 | #### - Student Attendance Page 30 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/second.gif) 31 | 32 | 33 | #### - Student Notice Page 34 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/third.gif) 35 | 36 | 37 | #### - Student Marks Page 38 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/fourth.gif) 39 | 40 | 41 | ### - Student Course Registration Page 42 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/fifth.gif) 43 | 44 | 45 | ### - Student Chat Room 46 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/sixth.gif) 47 | 48 |
49 | 50 | ## 2. Faculty Module 51 | 52 | ### - Faculty Login 53 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/f1.gif) 54 | 55 | 56 | ### - Faculty Upload Attendance 57 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/f2.gif) 58 | 59 | 60 | ### - Faculty Upload Marks 61 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/f3.gif) 62 | 63 | 64 | ### - Faculty Chat Room 65 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/f4.gif) 66 | 67 |
68 | 69 | ## 3. Admin (Owner) Module 70 | 71 | ### - Admin Login 72 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a1.gif) 73 | 74 | 75 | ### - Student Registration Form 76 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a2.gif) 77 | 78 | 79 | ### - Faculty Registration Form 80 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a3.gif) 81 | 82 | 83 | ### - Notices Uploaded 84 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a4.gif) 85 | 86 | 87 | ### - Updation of Student Details 88 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a5.gif) 89 | 90 | 91 | ### - Updation of Faculty Details 92 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a6.gif) 93 | 94 | 95 | ### - New Course Registration Form 96 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a7.gif) 97 | 98 | 99 | ### - Course Details 100 | ![](https://github.com/hjain5164/Screenshots/blob/master/Student-Management-System/a8.gif) 101 | 102 |
103 | 104 | So these were the three modules in this project!!! 105 | -------------------------------------------------------------------------------- /src/java/update_faculty_details.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.SQLException; 12 | import java.util.logging.Level; 13 | import java.util.logging.Logger; 14 | import javax.servlet.ServletException; 15 | import javax.servlet.annotation.WebServlet; 16 | import javax.servlet.http.HttpServlet; 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.servlet.http.HttpServletResponse; 19 | 20 | /** 21 | * 22 | * @author Harsh Jain 23 | */ 24 | @WebServlet(urlPatterns = {"/update_faculty_details"}) 25 | public class update_faculty_details extends HttpServlet { 26 | 27 | /** 28 | * Processes requests for both HTTP GET and POST 29 | * methods. 30 | * 31 | * @param request servlet request 32 | * @param response servlet response 33 | * @throws ServletException if a servlet-specific error occurs 34 | * @throws IOException if an I/O error occurs 35 | */ 36 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 37 | throws ServletException, IOException { 38 | response.setContentType("text/html;charset=UTF-8"); 39 | try (PrintWriter out = response.getWriter()) { 40 | /* TODO output your page here. You may use following sample code. */ 41 | 42 | Class.forName("com.mysql.jdbc.Driver"); 43 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | } catch (ClassNotFoundException ex) { 52 | Logger.getLogger(update_faculty_details.class.getName()).log(Level.SEVERE, null, ex); 53 | } catch (SQLException ex) { 54 | Logger.getLogger(update_faculty_details.class.getName()).log(Level.SEVERE, null, ex); 55 | } 56 | } 57 | 58 | // 59 | /** 60 | * Handles the HTTP GET method. 61 | * 62 | * @param request servlet request 63 | * @param response servlet response 64 | * @throws ServletException if a servlet-specific error occurs 65 | * @throws IOException if an I/O error occurs 66 | */ 67 | @Override 68 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 69 | throws ServletException, IOException { 70 | processRequest(request, response); 71 | } 72 | 73 | /** 74 | * Handles the HTTP POST method. 75 | * 76 | * @param request servlet request 77 | * @param response servlet response 78 | * @throws ServletException if a servlet-specific error occurs 79 | * @throws IOException if an I/O error occurs 80 | */ 81 | @Override 82 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 83 | throws ServletException, IOException { 84 | processRequest(request, response); 85 | } 86 | 87 | /** 88 | * Returns a short description of the servlet. 89 | * 90 | * @return a String containing servlet description 91 | */ 92 | @Override 93 | public String getServletInfo() { 94 | return "Short description"; 95 | }// 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/java/delete_notice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/delete_notice"}) 26 | public class delete_notice extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String image_path = (String) request.getParameter("imagepath"); 42 | Class.forName("com.mysql.jdbc.Driver"); 43 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 44 | String qr="delete from notices where image_path=?"; 45 | PreparedStatement ps=con.prepareStatement(qr); 46 | ps.setString(1,image_path); 47 | ps.executeUpdate(); 48 | response.sendRedirect("notices.jsp"); 49 | 50 | } catch (ClassNotFoundException | SQLException ex) { 51 | Logger.getLogger(delete_notice.class.getName()).log(Level.SEVERE, null, ex); 52 | } 53 | } 54 | 55 | // 56 | /** 57 | * Handles the HTTP GET method. 58 | * 59 | * @param request servlet request 60 | * @param response servlet response 61 | * @throws ServletException if a servlet-specific error occurs 62 | * @throws IOException if an I/O error occurs 63 | */ 64 | @Override 65 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 66 | throws ServletException, IOException { 67 | processRequest(request, response); 68 | } 69 | 70 | /** 71 | * Handles the HTTP POST method. 72 | * 73 | * @param request servlet request 74 | * @param response servlet response 75 | * @throws ServletException if a servlet-specific error occurs 76 | * @throws IOException if an I/O error occurs 77 | */ 78 | @Override 79 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 80 | throws ServletException, IOException { 81 | processRequest(request, response); 82 | } 83 | 84 | /** 85 | * Returns a short description of the servlet. 86 | * 87 | * @return a String containing servlet description 88 | */ 89 | @Override 90 | public String getServletInfo() { 91 | return "Short description"; 92 | }// 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/java/f_to_s.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/f_to_s"}) 26 | public class f_to_s extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String faculty_name = (String) request.getParameter("faculty_name"); 42 | String msg = (String) request.getParameter("message"); 43 | String student_name = (String) request.getParameter("student_name"); 44 | Class.forName("com.mysql.jdbc.Driver"); 45 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 46 | String qr="insert into messagef(msg,sid,fid) values(?,?,?)"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,msg); 49 | ps.setString(2, student_name); 50 | ps.setString(3,faculty_name); 51 | ps.executeUpdate(); 52 | response.sendRedirect("chat_faculty.jsp"); 53 | } catch (ClassNotFoundException | SQLException ex) { 54 | Logger.getLogger(f_to_s.class.getName()).log(Level.SEVERE, null, ex); 55 | } 56 | } 57 | 58 | // 59 | /** 60 | * Handles the HTTP GET method. 61 | * 62 | * @param request servlet request 63 | * @param response servlet response 64 | * @throws ServletException if a servlet-specific error occurs 65 | * @throws IOException if an I/O error occurs 66 | */ 67 | @Override 68 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 69 | throws ServletException, IOException { 70 | processRequest(request, response); 71 | } 72 | 73 | /** 74 | * Handles the HTTP POST method. 75 | * 76 | * @param request servlet request 77 | * @param response servlet response 78 | * @throws ServletException if a servlet-specific error occurs 79 | * @throws IOException if an I/O error occurs 80 | */ 81 | @Override 82 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 83 | throws ServletException, IOException { 84 | processRequest(request, response); 85 | } 86 | 87 | /** 88 | * Returns a short description of the servlet. 89 | * 90 | * @return a String containing servlet description 91 | */ 92 | @Override 93 | public String getServletInfo() { 94 | return "Short description"; 95 | }// 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/java/update_faculty_password.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_faculty_password"}) 26 | public class update_faculty_password extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String uname = (String) request.getParameter("password"); 42 | String username = (String) request.getSession().getAttribute("faculty_user"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 46 | String qr="update login set password=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,uname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_faculty_details.jsp?faculty_username="+username); 52 | } catch (ClassNotFoundException ex) { 53 | Logger.getLogger(update_faculty_password.class.getName()).log(Level.SEVERE, null, ex); 54 | } catch (SQLException ex) { 55 | Logger.getLogger(update_faculty_password.class.getName()).log(Level.SEVERE, null, ex); 56 | } 57 | } 58 | 59 | // 60 | /** 61 | * Handles the HTTP GET method. 62 | * 63 | * @param request servlet request 64 | * @param response servlet response 65 | * @throws ServletException if a servlet-specific error occurs 66 | * @throws IOException if an I/O error occurs 67 | */ 68 | @Override 69 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 70 | throws ServletException, IOException { 71 | processRequest(request, response); 72 | } 73 | 74 | /** 75 | * Handles the HTTP POST method. 76 | * 77 | * @param request servlet request 78 | * @param response servlet response 79 | * @throws ServletException if a servlet-specific error occurs 80 | * @throws IOException if an I/O error occurs 81 | */ 82 | @Override 83 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 84 | throws ServletException, IOException { 85 | processRequest(request, response); 86 | } 87 | 88 | /** 89 | * Returns a short description of the servlet. 90 | * 91 | * @return a String containing servlet description 92 | */ 93 | @Override 94 | public String getServletInfo() { 95 | return "Short description"; 96 | }// 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/java/s_to_f.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.util.logging.Level; 12 | import java.util.logging.Logger; 13 | import java.sql.PreparedStatement; 14 | import java.sql.SQLException; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/s_to_f"}) 26 | public class s_to_f extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String faculty_name = (String) request.getParameter("faculty_name"); 42 | String msg = (String) request.getParameter("message"); 43 | String student_name = (String) request.getParameter("student_name"); 44 | Class.forName("com.mysql.jdbc.Driver"); 45 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 46 | String qr="insert into messages(msg,sid,fid) values(?,?,?)"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,msg); 49 | ps.setString(2, student_name); 50 | ps.setString(3,faculty_name); 51 | ps.executeUpdate(); 52 | response.sendRedirect("chat_student.jsp"); 53 | // ResultSet rs=ps.executeQuery(); 54 | 55 | } catch (ClassNotFoundException | SQLException ex) { 56 | Logger.getLogger(s_to_f.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/total_lectures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/total_lectures"}) 27 | public class total_lectures extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | /* TODO output your page here. You may use following sample code. */ 43 | String course_name = (String) request.getParameter("course_name"); 44 | Class.forName("com.mysql.jdbc.Driver"); 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 46 | String qr="select total from courses where course_name=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,course_name); 49 | ResultSet rs1=ps.executeQuery(); 50 | if(rs1.next()) 51 | { 52 | response.sendRedirect("upload_attendance.jsp?course_name="+course_name+"&total="+rs1.getInt("total")); 53 | 54 | } 55 | 56 | } catch (SQLException | ClassNotFoundException ex) { 57 | Logger.getLogger(total_lectures.class.getName()).log(Level.SEVERE, null, ex); 58 | } 59 | } 60 | 61 | // 62 | /** 63 | * Handles the HTTP GET method. 64 | * 65 | * @param request servlet request 66 | * @param response servlet response 67 | * @throws ServletException if a servlet-specific error occurs 68 | * @throws IOException if an I/O error occurs 69 | */ 70 | @Override 71 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 72 | throws ServletException, IOException { 73 | processRequest(request, response); 74 | } 75 | 76 | /** 77 | * Handles the HTTP POST method. 78 | * 79 | * @param request servlet request 80 | * @param response servlet response 81 | * @throws ServletException if a servlet-specific error occurs 82 | * @throws IOException if an I/O error occurs 83 | */ 84 | @Override 85 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 86 | throws ServletException, IOException { 87 | processRequest(request, response); 88 | } 89 | 90 | /** 91 | * Returns a short description of the servlet. 92 | * 93 | * @return a String containing servlet description 94 | */ 95 | @Override 96 | public String getServletInfo() { 97 | return "Short description"; 98 | }// 99 | 100 | } 101 | -------------------------------------------------------------------------------- /web/faculty_home.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : faculty_login 3 | Created on : 17 Sep, 2018, 7:27:25 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.PreparedStatement"%> 8 | <%@page import="java.sql.ResultSet"%> 9 | <%@page import="java.sql.Statement"%> 10 | <%@page import="java.sql.DriverManager"%> 11 | <%@page import="java.sql.Connection"%> 12 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 13 | 14 | 15 | 16 | 17 | Faculty Portal 18 | 19 | 25 | 26 | 27 | 28 | <% 29 | String user = (String)request.getParameter("username"); 30 | if(user!=null) 31 | session.setAttribute("uname", user); 32 | %> 33 |
34 |
ABC Insitute
36 |
37 | 46 |
47 |
48 | <% 49 | String username = (String)session.getAttribute("uname"); 50 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 51 | String qr="select image_path from login where username='"+username+"'"; 52 | PreparedStatement ps=con.prepareStatement(qr); 53 | ResultSet rs=ps.executeQuery(); 54 | if(rs.next()) 55 | { 56 | %> 57 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 58 | ; margin-top: 20px"> 59 | <%}%> 60 |

61 |
62 | 63 |
64 |

65 |

66 | <% 67 | Class.forName("com.mysql.jdbc.Driver"); 68 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 69 | qr="select fname,lname,department,age from login where username=?"; 70 | ps=con.prepareStatement(qr); 71 | ps.setString(1,username); 72 | rs=ps.executeQuery(); 73 | while(rs.next()) 74 | { 75 | String fname = rs.getString("fname"); 76 | String lname = rs.getString("lname"); 77 | String department = rs.getString("department"); 78 | int age = rs.getInt("age"); 79 | %> 80 | 81 | Name : <%=fname+" "+lname%> 82 |

83 | Department : <%=department%> 84 |

85 | Age : <%=age%> 86 |

87 | <%}%> 88 |

89 | 90 | 91 |
92 |

93 |
94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/java/update_faculty_fname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_faculty_fname"}) 26 | public class update_faculty_fname extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String fname = (String) request.getParameter("fname"); 42 | String username = (String) request.getSession().getAttribute("faculty_user"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 46 | String qr="update login set fname=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,fname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_faculty_details.jsp?faculty_username="+username); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_faculty_fname.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_faculty_fname.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/update_faculty_lname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_faculty_lname"}) 26 | public class update_faculty_lname extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String lname = (String) request.getParameter("lname"); 42 | String username = (String) request.getSession().getAttribute("faculty_user"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 46 | String qr="update login set lname=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,lname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_faculty_details.jsp?faculty_username="+username); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_faculty_lname.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_faculty_lname.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/update_faculty_uname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_faculty_uname"}) 26 | public class update_faculty_uname extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String uname = (String) request.getParameter("username"); 42 | String username = (String) request.getSession().getAttribute("faculty_user"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 46 | String qr="update login set username=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,uname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_faculty_details.jsp?faculty_username="+uname); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_faculty_uname.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_faculty_uname.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/update_student_fname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_student_fname"}) 26 | public class update_student_fname extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String fname = (String) request.getParameter("fname"); 42 | String username = (String) request.getSession().getAttribute("student_username"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 46 | String qr="update login set fname=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,fname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_student_details.jsp?student_username="+username); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_student_fname.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_student_fname.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/update_student_lname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_student_lname"}) 26 | public class update_student_lname extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String lname = (String) request.getParameter("lname"); 42 | String username = (String) request.getSession().getAttribute("student_username"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 46 | String qr="update login set lname=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,lname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_student_details.jsp?student_username="+username); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_student_lname.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_student_lname.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/update_student_uname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_student_uname"}) 26 | public class update_student_uname extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String uname = (String) request.getParameter("username"); 42 | String username = (String) request.getSession().getAttribute("student_username"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 46 | String qr="update login set username=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,uname); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_student_details.jsp?student_username="+uname); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_student_uname.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_student_uname.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/update_student_password.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_student_password"}) 26 | public class update_student_password extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String password = (String) request.getParameter("password"); 42 | String username = (String) request.getSession().getAttribute("student_username"); 43 | Class.forName("com.mysql.jdbc.Driver"); 44 | 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 46 | String qr="update login set password=? where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,password); 49 | ps.setString(2,username); 50 | ps.executeUpdate(); 51 | response.sendRedirect("show_student_details.jsp?student_username="+username); 52 | 53 | } catch (ClassNotFoundException ex) { 54 | Logger.getLogger(update_student_password.class.getName()).log(Level.SEVERE, null, ex); 55 | } catch (SQLException ex) { 56 | Logger.getLogger(update_student_password.class.getName()).log(Level.SEVERE, null, ex); 57 | } 58 | } 59 | 60 | // 61 | /** 62 | * Handles the HTTP GET method. 63 | * 64 | * @param request servlet request 65 | * @param response servlet response 66 | * @throws ServletException if a servlet-specific error occurs 67 | * @throws IOException if an I/O error occurs 68 | */ 69 | @Override 70 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 71 | throws ServletException, IOException { 72 | processRequest(request, response); 73 | } 74 | 75 | /** 76 | * Handles the HTTP POST method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | processRequest(request, response); 87 | } 88 | 89 | /** 90 | * Returns a short description of the servlet. 91 | * 92 | * @return a String containing servlet description 93 | */ 94 | @Override 95 | public String getServletInfo() { 96 | return "Short description"; 97 | }// 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/java/fetch_faculty_details.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/fetch_faculty_details"}) 27 | public class fetch_faculty_details extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | String username = request.getParameter("faculty_username"); 43 | // String password = request.getParameter("password"); 44 | Class.forName("com.mysql.jdbc.Driver"); 45 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 46 | String qr="select * from login where username=?"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ps.setString(1,username); 49 | // ps.setString(2,password); 50 | ResultSet rs=ps.executeQuery(); 51 | if(rs.next()) 52 | { 53 | response.sendRedirect("show_faculty_details.jsp?faculty_username="+username); 54 | } 55 | else 56 | response.sendRedirect("faculty_details.jsp?status="+"F"); 57 | } catch (ClassNotFoundException | SQLException ex) { 58 | Logger.getLogger(fetch_student_details.class.getName()).log(Level.SEVERE, null, ex); 59 | } 60 | 61 | } 62 | 63 | // 64 | /** 65 | * Handles the HTTP GET method. 66 | * 67 | * @param request servlet request 68 | * @param response servlet response 69 | * @throws ServletException if a servlet-specific error occurs 70 | * @throws IOException if an I/O error occurs 71 | */ 72 | @Override 73 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 74 | throws ServletException, IOException { 75 | processRequest(request, response); 76 | } 77 | 78 | /** 79 | * Handles the HTTP POST method. 80 | * 81 | * @param request servlet request 82 | * @param response servlet response 83 | * @throws ServletException if a servlet-specific error occurs 84 | * @throws IOException if an I/O error occurs 85 | */ 86 | @Override 87 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 88 | throws ServletException, IOException { 89 | processRequest(request, response); 90 | } 91 | 92 | /** 93 | * Returns a short description of the servlet. 94 | * 95 | * @return a String containing servlet description 96 | */ 97 | @Override 98 | public String getServletInfo() { 99 | return "Short description"; 100 | }// 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/java/fetch_student_details.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/fetch_student_details"}) 27 | public class fetch_student_details extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | /* TODO output your page here. You may use following sample code. */ 43 | String username = request.getParameter("student_username"); 44 | // String password = request.getParameter("password"); 45 | Class.forName("com.mysql.jdbc.Driver"); 46 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 47 | String qr="select * from login where username=?"; 48 | PreparedStatement ps=con.prepareStatement(qr); 49 | ps.setString(1,username); 50 | // ps.setString(2,password); 51 | ResultSet rs=ps.executeQuery(); 52 | if(rs.next()) 53 | { 54 | response.sendRedirect("show_student_details.jsp?student_username="+username); 55 | } 56 | else 57 | response.sendRedirect("student_details.jsp?status="+"F"); 58 | } catch (ClassNotFoundException | SQLException ex) { 59 | Logger.getLogger(fetch_student_details.class.getName()).log(Level.SEVERE, null, ex); 60 | } 61 | } 62 | 63 | // 64 | /** 65 | * Handles the HTTP GET method. 66 | * 67 | * @param request servlet request 68 | * @param response servlet response 69 | * @throws ServletException if a servlet-specific error occurs 70 | * @throws IOException if an I/O error occurs 71 | */ 72 | @Override 73 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 74 | throws ServletException, IOException { 75 | processRequest(request, response); 76 | } 77 | 78 | /** 79 | * Handles the HTTP POST method. 80 | * 81 | * @param request servlet request 82 | * @param response servlet response 83 | * @throws ServletException if a servlet-specific error occurs 84 | * @throws IOException if an I/O error occurs 85 | */ 86 | @Override 87 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 88 | throws ServletException, IOException { 89 | processRequest(request, response); 90 | } 91 | 92 | /** 93 | * Returns a short description of the servlet. 94 | * 95 | * @return a String containing servlet description 96 | */ 97 | @Override 98 | public String getServletInfo() { 99 | return "Short description"; 100 | }// 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/java/enrollFaculty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/enrollFaculty"}) 26 | public class enrollFaculty extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | /* TODO output your page here. You may use following sample code. */ 42 | String fname =(String) request.getParameter("fname"); 43 | String lname =(String) request.getParameter("lname"); 44 | String username =(String) request.getParameter("username"); 45 | String password =(String) request.getParameter("password"); 46 | String department =(String) request.getParameter("department"); 47 | String age = (String) request.getParameter("age"); 48 | 49 | Class.forName("com.mysql.jdbc.Driver"); 50 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 51 | String qr="insert into login(username,password,fname,lname,department,age) values(?,?,?,?,?,?)"; 52 | PreparedStatement ps=con.prepareStatement(qr); 53 | ps.setString(1,username); 54 | ps.setString(2,password); 55 | ps.setString(3,fname); 56 | ps.setString(4,lname); 57 | ps.setString(5,department); 58 | ps.setString(6,age); 59 | ps.executeUpdate(); 60 | response.sendRedirect("enroll_faculty.jsp"); 61 | } catch (ClassNotFoundException | SQLException ex) { 62 | Logger.getLogger(enrollFaculty.class.getName()).log(Level.SEVERE, null, ex); 63 | } 64 | } 65 | 66 | // 67 | /** 68 | * Handles the HTTP GET method. 69 | * 70 | * @param request servlet request 71 | * @param response servlet response 72 | * @throws ServletException if a servlet-specific error occurs 73 | * @throws IOException if an I/O error occurs 74 | */ 75 | @Override 76 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 77 | throws ServletException, IOException { 78 | processRequest(request, response); 79 | } 80 | 81 | /** 82 | * Handles the HTTP POST method. 83 | * 84 | * @param request servlet request 85 | * @param response servlet response 86 | * @throws ServletException if a servlet-specific error occurs 87 | * @throws IOException if an I/O error occurs 88 | */ 89 | @Override 90 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 91 | throws ServletException, IOException { 92 | processRequest(request, response); 93 | } 94 | 95 | /** 96 | * Returns a short description of the servlet. 97 | * 98 | * @return a String containing servlet description 99 | */ 100 | @Override 101 | public String getServletInfo() { 102 | return "Short description"; 103 | }// 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/java/update_marks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.SQLException; 13 | import java.util.logging.Level; 14 | import java.util.logging.Logger; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | /** 22 | * 23 | * @author Harsh Jain 24 | */ 25 | @WebServlet(urlPatterns = {"/update_marks"}) 26 | public class update_marks extends HttpServlet { 27 | 28 | /** 29 | * Processes requests for both HTTP GET and POST 30 | * methods. 31 | * 32 | * @param request servlet request 33 | * @param response servlet response 34 | * @throws ServletException if a servlet-specific error occurs 35 | * @throws IOException if an I/O error occurs 36 | */ 37 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 38 | throws ServletException, IOException { 39 | response.setContentType("text/html;charset=UTF-8"); 40 | try (PrintWriter out = response.getWriter()) { 41 | String course_name = (String) request.getSession().getAttribute("course_name"); 42 | String marks =(String) request.getParameter("var"); 43 | // String total = (String) request.getParameter("total"); 44 | // if(present==null) 45 | // response.sendRedirect("upload_attendance.jsp?course_name="+course_name); 46 | // else 47 | // { 48 | String u = request.getParameter("student_id"); 49 | String roll [] = u.split(","); 50 | int b [] = new int[roll.length]; 51 | for(int i=0; i 76 | /** 77 | * Handles the HTTP GET method. 78 | * 79 | * @param request servlet request 80 | * @param response servlet response 81 | * @throws ServletException if a servlet-specific error occurs 82 | * @throws IOException if an I/O error occurs 83 | */ 84 | @Override 85 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 86 | throws ServletException, IOException { 87 | processRequest(request, response); 88 | } 89 | 90 | /** 91 | * Handles the HTTP POST method. 92 | * 93 | * @param request servlet request 94 | * @param response servlet response 95 | * @throws ServletException if a servlet-specific error occurs 96 | * @throws IOException if an I/O error occurs 97 | */ 98 | @Override 99 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 100 | throws ServletException, IOException { 101 | processRequest(request, response); 102 | } 103 | 104 | /** 105 | * Returns a short description of the servlet. 106 | * 107 | * @return a String containing servlet description 108 | */ 109 | @Override 110 | public String getServletInfo() { 111 | return "Short description"; 112 | }// 113 | 114 | } 115 | -------------------------------------------------------------------------------- /web/faculty_notice.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : faculty_notice 3 | Created on : 17 Sep, 2018, 9:10:21 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Upload Notices 17 | 18 | 25 | 26 | 27 |
28 |
ABC Insitute
30 |
31 | 41 |
42 |
43 |
44 |

45 | 46 |
47 |









48 |
49 | 50 |
51 | 52 |
53 |
54 | <% String username = (String)session.getAttribute("uname"); 55 | 56 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 57 | String qr="select image_path from login where username='"+username+"'"; 58 | PreparedStatement ps=con.prepareStatement(qr); 59 | ResultSet rs=ps.executeQuery(); 60 | if(rs.next()) 61 | { 62 | %> 63 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 64 | ; margin-top: 20px"> 65 | 66 | <% 67 | 68 | } 69 | %> 70 |

71 |
72 | 73 | 74 |
75 |

76 |

77 | <% 78 | // String username = (String)session.getAttribute("uname"); 79 | 80 | Class.forName("com.mysql.jdbc.Driver"); 81 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 82 | qr="select fname,lname,department,age from login where username=?"; 83 | ps=con.prepareStatement(qr); 84 | ps.setString(1,username); 85 | rs=ps.executeQuery(); 86 | // out.println(username); 87 | while(rs.next()) 88 | { 89 | String fname = rs.getString("fname"); 90 | String lname = rs.getString("lname"); 91 | // out.println("Pass"); 92 | String department = rs.getString("department"); 93 | int age = rs.getInt("age"); 94 | %> 95 | 96 | Name : 97 | <%=fname+" "+lname%> 98 |
99 |
100 | Department : 101 | <%=department%> 102 |

103 | Age : 104 | <%=age%> 105 |

106 | <% } 107 | 108 | %> 109 |

110 | 111 | 112 |
113 |

114 |
115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /web/update_faculty_image.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : update_faculty_image 3 | Created on : 18 Oct, 2018, 10:07:23 AM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Faculty Portal 17 | 18 | 24 | 25 | 26 | 27 | <% 28 | String user = (String)request.getParameter("username"); 29 | if(user!=null) 30 | session.setAttribute("uname", user); 31 | %> 32 |
33 |
ABC Insitute
35 |
36 | 46 |
47 |
48 | <% String username = (String)session.getAttribute("uname"); 49 | session.setAttribute("faculty_username", username); 50 | session.setAttribute("A", "FF"); 51 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 52 | String qr="select image_path from login where username='"+username+"'"; 53 | PreparedStatement ps=con.prepareStatement(qr); 54 | ResultSet rs=ps.executeQuery(); 55 | if(rs.next()) 56 | { 57 | %> 58 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 59 | ; margin-top: 20px"> 60 | 61 | <% 62 | 63 | } 64 | %> 65 |

66 |
67 | 68 | 69 |
70 |

71 |

72 | <% 73 | // String username = (String)session.getAttribute("uname"); 74 | 75 | Class.forName("com.mysql.jdbc.Driver"); 76 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 77 | qr="select fname,lname,department,age from login where username=?"; 78 | ps=con.prepareStatement(qr); 79 | ps.setString(1,username); 80 | rs=ps.executeQuery(); 81 | // out.println(username); 82 | while(rs.next()) 83 | { 84 | String fname = rs.getString("fname"); 85 | String lname = rs.getString("lname"); 86 | // out.println("Pass"); 87 | String department = rs.getString("department"); 88 | int age = rs.getInt("age"); 89 | %> 90 | 91 | Name : 92 | <%=fname+" "+lname%> 93 |
94 |
95 | Department : 96 | <%=department%> 97 |

98 | Age : 99 | <%=age%> 100 |

101 | <% } 102 | 103 | %> 104 |

105 | 106 | 107 |
108 |

109 |
110 |
111 |
112 | 113 | 114 |
115 |
116 | 117 | 118 | -------------------------------------------------------------------------------- /web/see_notices.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : see_notices 3 | Created on : 5 Oct, 2018, 9:32:11 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Upload Notices 17 | 18 | 25 | 26 | 27 |
28 |
ABC Insitute
30 |
31 | 41 |
42 |
43 | 44 | <% 45 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 46 | String qr="select image_path from notices"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ResultSet rs=ps.executeQuery(); 49 | while(rs.next()) 50 | { 51 | %> 52 | " height="600px" width="600px"> 53 |
54 | <% 55 | 56 | } 57 | %> 58 | 59 |
60 |
61 | <% String username = (String)session.getAttribute("uname"); 62 | 63 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 64 | qr="select image_path from login where username='"+username+"'"; 65 | ps=con.prepareStatement(qr); 66 | rs=ps.executeQuery(); 67 | if(rs.next()) 68 | { 69 | %> 70 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 71 | ; margin-top: 20px"> 72 | 73 | <% 74 | 75 | } 76 | %> 77 |

78 |
79 | 80 | 81 |
82 |

83 |

84 | <% 85 | // String username = (String)session.getAttribute("uname"); 86 | 87 | Class.forName("com.mysql.jdbc.Driver"); 88 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 89 | qr="select fname,lname,department,age from login where username=?"; 90 | ps=con.prepareStatement(qr); 91 | ps.setString(1,username); 92 | rs=ps.executeQuery(); 93 | // out.println(username); 94 | while(rs.next()) 95 | { 96 | String fname = rs.getString("fname"); 97 | String lname = rs.getString("lname"); 98 | // out.println("Pass"); 99 | String department = rs.getString("department"); 100 | int age = rs.getInt("age"); 101 | %> 102 | 103 | Name : 104 | <%=fname+" "+lname%> 105 |
106 |
107 | Department : 108 | <%=department%> 109 |

110 | Age : 111 | <%=age%> 112 |

113 | <% } 114 | 115 | %> 116 |

117 | 118 | 119 |
120 |

121 |
122 | 123 | 124 | -------------------------------------------------------------------------------- /web/see_student_notice.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : see_student_notice 3 | Created on : 10 Oct, 2018, 5:31:41 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Upload Notices 17 | 18 | 24 | 25 | 26 |
27 |
ABC Insitute
29 |
30 | 41 |
42 |
43 | 44 | <% 45 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 46 | String qr="select image_path from notices"; 47 | PreparedStatement ps=con.prepareStatement(qr); 48 | ResultSet rs=ps.executeQuery(); 49 | while(rs.next()) 50 | { 51 | %> 52 | " height="600px" width="600px"> 53 |
54 | <% 55 | 56 | } 57 | %> 58 | 59 |
60 |
61 | <% 62 | String user = (String) session.getAttribute("uname"); 63 | 64 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 65 | qr="select imagepath from login where username='"+user+"'"; 66 | ps=con.prepareStatement(qr); 67 | rs=ps.executeQuery(); 68 | if(rs.next()) 69 | { 70 | %> 71 | " height="100px" width="100px" style="border-radius: 10px; margin-left: 85px 72 | ; margin-top: 20px"> 73 | 74 | <% 75 | 76 | } 77 | %> 78 |

79 |
80 | 81 | 82 |
83 |

84 |

85 | <% 86 | String username = (String)session.getAttribute("uname"); 87 | 88 | Class.forName("com.mysql.jdbc.Driver"); 89 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 90 | qr="select fname,lname,department,roll from login where username=?"; 91 | ps=con.prepareStatement(qr); 92 | ps.setString(1,username); 93 | rs=ps.executeQuery(); 94 | // out.println(username); 95 | while(rs.next()) 96 | { 97 | String roll = rs.getString("roll"); 98 | String fname = rs.getString("fname"); 99 | String lname = rs.getString("lname"); 100 | // out.println("Pass"); 101 | String department = rs.getString("department"); 102 | 103 | %> 104 | Roll Number : 105 | <%=roll%> 106 |

107 | Name : 108 | <%=fname+" "+lname%> 109 |
110 |
111 | Department : 112 | <%=department%> 113 |

114 | <% } 115 | 116 | %> 117 |

118 | 119 | 120 |
121 |

122 |
123 | 124 | 125 | -------------------------------------------------------------------------------- /src/java/enrollStudent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | import java.sql.Connection; 11 | import java.sql.DriverManager; 12 | import java.sql.PreparedStatement; 13 | import java.sql.SQLException; 14 | import java.sql.Statement; 15 | import java.util.Iterator; 16 | import java.util.List; 17 | import java.util.logging.Level; 18 | import java.util.logging.Logger; 19 | import javax.servlet.ServletException; 20 | import javax.servlet.annotation.WebServlet; 21 | import javax.servlet.http.HttpServlet; 22 | import javax.servlet.http.HttpServletRequest; 23 | import javax.servlet.http.HttpServletResponse; 24 | import org.apache.commons.fileupload.FileItem; 25 | import org.apache.commons.fileupload.FileItemFactory; 26 | import org.apache.commons.fileupload.FileUploadException; 27 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; 28 | import org.apache.commons.fileupload.servlet.ServletFileUpload; 29 | 30 | /** 31 | * 32 | * @author Harsh Jain 33 | */ 34 | @WebServlet(urlPatterns = {"/enrollStudent"}) 35 | public class enrollStudent extends HttpServlet { 36 | 37 | /** 38 | * Processes requests for both HTTP GET and POST 39 | * methods. 40 | * 41 | * @param request servlet request 42 | * @param response servlet response 43 | * @throws ServletException if a servlet-specific error occurs 44 | * @throws IOException if an I/O error occurs 45 | */ 46 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 47 | throws ServletException, IOException { 48 | response.setContentType("text/html;charset=UTF-8"); 49 | try (PrintWriter out = response.getWriter()) { 50 | /* TODO output your page here. You may use following sample code. */ 51 | String fname =(String) request.getParameter("fname"); 52 | String lname =(String) request.getParameter("lname"); 53 | String username =(String) request.getParameter("username"); 54 | String password =(String) request.getParameter("password"); 55 | String department =(String) request.getParameter("department"); 56 | String r = (String) request.getParameter("roll"); 57 | String roll = r; 58 | Class.forName("com.mysql.jdbc.Driver"); 59 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 60 | String qr="insert into login(username,password,fname,lname,department,roll) values(?,?,?,?,?,?)"; 61 | PreparedStatement ps=con.prepareStatement(qr); 62 | ps.setString(1,username); 63 | ps.setString(2,password); 64 | ps.setString(3,fname); 65 | ps.setString(4,lname); 66 | ps.setString(5,department); 67 | ps.setString(6,roll); 68 | ps.executeUpdate(); 69 | response.sendRedirect("enroll_student.jsp"); 70 | 71 | } catch (SQLException ex) { 72 | Logger.getLogger(enrollStudent.class.getName()).log(Level.SEVERE, null, ex); 73 | } catch (ClassNotFoundException ex) { 74 | Logger.getLogger(enrollStudent.class.getName()).log(Level.SEVERE, null, ex); 75 | } 76 | } 77 | 78 | // 79 | /** 80 | * Handles the HTTP GET method. 81 | * 82 | * @param request servlet request 83 | * @param response servlet response 84 | * @throws ServletException if a servlet-specific error occurs 85 | * @throws IOException if an I/O error occurs 86 | */ 87 | @Override 88 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 89 | throws ServletException, IOException { 90 | processRequest(request, response); 91 | } 92 | 93 | /** 94 | * Handles the HTTP POST method. 95 | * 96 | * @param request servlet request 97 | * @param response servlet response 98 | * @throws ServletException if a servlet-specific error occurs 99 | * @throws IOException if an I/O error occurs 100 | */ 101 | @Override 102 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 103 | throws ServletException, IOException { 104 | processRequest(request, response); 105 | } 106 | 107 | /** 108 | * Returns a short description of the servlet. 109 | * 110 | * @return a String containing servlet description 111 | */ 112 | @Override 113 | public String getServletInfo() { 114 | return "Short description"; 115 | }// 116 | 117 | } 118 | -------------------------------------------------------------------------------- /web/update_admin_image.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : update_admin_image 3 | Created on : 13 Oct, 2018, 10:25:29 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Student Home 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | <% 30 | String user = (String)request.getParameter("username"); 31 | if(user!=null) 32 | session.setAttribute("uname", user); 33 | %> 34 |
35 |
ABC Insitute
37 |
38 | 49 |
50 |
51 | <% 52 | user =(String) session.getAttribute("uname"); 53 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 54 | String qr="select image_path from admin where username='"+user+"'"; 55 | PreparedStatement ps=con.prepareStatement(qr); 56 | ResultSet rs=ps.executeQuery(); 57 | if(rs.next()) 58 | { 59 | %> 60 | " height="100px" width="100px" style="border-radius: 10px; margin-left: 85px 61 | ; margin-top: 20px "> 62 | 63 | <% 64 | 65 | } 66 | %> 67 |

68 |
69 | 70 | 71 |
72 |

73 |

74 | <% 75 | String username = (String)session.getAttribute("uname"); 76 | session.setAttribute("A", "AA"); 77 | Class.forName("com.mysql.jdbc.Driver"); 78 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 79 | qr="select fname,lname,age from admin where username=?"; 80 | ps=con.prepareStatement(qr); 81 | ps.setString(1,username); 82 | rs=ps.executeQuery(); 83 | // out.println(username); 84 | while(rs.next()) 85 | { 86 | String age = rs.getString("age"); 87 | String fname = rs.getString("fname"); 88 | String lname = rs.getString("lname"); 89 | // out.println("Pass"); 90 | // String department = rs.getString("department"); 91 | 92 | %> 93 | 94 | Name : 95 | <%=fname+" "+lname%> 96 |
97 |
98 | Age : 99 | <%=age%> 100 |

101 | <% } 102 | 103 | %> 104 |

105 | 106 | 107 |
108 |

109 |
110 | 111 |
112 |
113 | 114 | <% session.setAttribute("A","AA"); 115 | %> 116 | 117 |
118 |
119 | 120 | -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : index 3 | Created on : 18 Sep, 2018, 9:51:12 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | 13 | 14 | ABC Institute 15 | 24 | 29 | 30 | 31 | 98 | 99 | 100 |
101 | 102 |
103 |
104 |
105 |

ABC institute

106 |

Login Portal

107 | <% 108 | String status = (String)request.getParameter("status"); 109 | if(status==null) 110 | status="T"; 111 | %> 112 |
113 | Faculty   114 | Student login   115 | Admin login
116 |
117 | <%if(status.equals("F")) 118 | {%> 119 | Username and Password do not match!! 120 | <%} 121 | else if(status.equals("L")) 122 | { 123 | %> 124 | Select login account type!! 125 | <%} 126 | else{} 127 | %> 128 |
129 |
130 |      133 | 135 | 136 |
137 |
138 | 139 |
140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /web/new_faculty_message.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : new_faculty_message 3 | Created on : 24 Oct, 2018, 10:21:57 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Faculty Portal 17 | 18 | 24 | 25 | 26 | 27 | <% 28 | String user = (String)request.getParameter("username"); 29 | if(user!=null) 30 | session.setAttribute("uname", user); 31 | %> 32 |
33 |
ABC Insitute
35 |
36 | 45 |
46 |
47 | <% 48 | String username = (String)session.getAttribute("uname"); 49 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 50 | String qr="select image_path from login where username='"+username+"'"; 51 | PreparedStatement ps=con.prepareStatement(qr); 52 | ResultSet rs=ps.executeQuery(); 53 | if(rs.next()) 54 | { 55 | %> 56 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 57 | ; margin-top: 20px"> 58 | <%}%> 59 |

60 |
61 | 62 |
63 |

64 |

65 | <% 66 | Class.forName("com.mysql.jdbc.Driver"); 67 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 68 | qr="select fname,lname,department,age from login where username=?"; 69 | ps=con.prepareStatement(qr); 70 | ps.setString(1,username); 71 | rs=ps.executeQuery(); 72 | while(rs.next()) 73 | { 74 | String fname = rs.getString("fname"); 75 | String lname = rs.getString("lname"); 76 | String department = rs.getString("department"); 77 | int age = rs.getInt("age"); 78 | %> 79 | 80 | Name : <%=fname+" "+lname%> 81 |

82 | Department : <%=department%> 83 |

84 | Age : <%=age%> 85 |

86 | <%}%> 87 |

88 | 89 | 90 |
91 |

92 |
93 | 94 |
95 | 96 | <% 97 | String student_name = (String) request.getParameter("student_name"); 98 | if(student_name == null) 99 | student_name = (String) request.getParameter("fac_name"); 100 | %> 101 |
102 | 103 | 104 | 105 | 106 | 107 | 108 |
109 | 110 |

111 | 112 | -------------------------------------------------------------------------------- /src/java/register_course.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/register_course"}) 27 | public class register_course extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | String course_id = (String) request.getParameter("course_id"); 43 | String uname = (String) request.getSession().getAttribute("uname"); 44 | Class.forName("com.mysql.jdbc.Driver"); 45 | // session.setAttribute("A", "SA"); 46 | String course_name=""; 47 | int roll=0,total=30; 48 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 49 | String qr1 = "select course_name from courses where course_id=?"; 50 | PreparedStatement ps1 = con.prepareStatement(qr1); 51 | ps1.setString(1,course_id); 52 | ResultSet rs1 = ps1.executeQuery(); 53 | if(rs1.next()) 54 | course_name=rs1.getString("course_name"); 55 | 56 | con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 57 | qr1 = "select roll from courses where username=?"; 58 | ps1 = con.prepareStatement(qr1); 59 | ps1.setString(1,uname); 60 | rs1 = ps1.executeQuery(); 61 | if(rs1.next()) 62 | roll=rs1.getInt("roll"); 63 | String qr="insert into courses(username,course_id,course_name,roll,total) values(?,?,?,?,?)"; 64 | PreparedStatement ps=con.prepareStatement(qr); 65 | ps.setString(1,uname); 66 | ps.setString(2,course_id); 67 | ps.setString(3,course_name); 68 | ps.setInt(4,roll); 69 | ps.setInt(5,total); 70 | ps.executeUpdate(); 71 | response.sendRedirect("student_home.jsp"); 72 | 73 | // ResultSet rs = ps.executeQuery(); 74 | } catch (ClassNotFoundException | SQLException ex) { 75 | Logger.getLogger(register_course.class.getName()).log(Level.SEVERE, null, ex); 76 | } 77 | } 78 | 79 | // 80 | /** 81 | * Handles the HTTP GET method. 82 | * 83 | * @param request servlet request 84 | * @param response servlet response 85 | * @throws ServletException if a servlet-specific error occurs 86 | * @throws IOException if an I/O error occurs 87 | */ 88 | @Override 89 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 90 | throws ServletException, IOException { 91 | processRequest(request, response); 92 | } 93 | 94 | /** 95 | * Handles the HTTP POST method. 96 | * 97 | * @param request servlet request 98 | * @param response servlet response 99 | * @throws ServletException if a servlet-specific error occurs 100 | * @throws IOException if an I/O error occurs 101 | */ 102 | @Override 103 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 104 | throws ServletException, IOException { 105 | processRequest(request, response); 106 | } 107 | 108 | /** 109 | * Returns a short description of the servlet. 110 | * 111 | * @return a String containing servlet description 112 | */ 113 | @Override 114 | public String getServletInfo() { 115 | return "Short description"; 116 | }// 117 | 118 | } 119 | -------------------------------------------------------------------------------- /web/new_student_message.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : new_student_message 3 | Created on : 24 Oct, 2018, 8:26:31 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Student Home 17 | 18 | 19 | 25 | 26 | 27 | <% 28 | String user = (String)request.getParameter("username"); 29 | if(user!=null) 30 | session.setAttribute("uname", user); 31 | %> 32 |
33 |
ABC Insitute
35 |
36 | 45 |
46 |
47 | <% 48 | user = (String) session.getAttribute("uname"); 49 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 50 | String qr="select imagepath from login where username='"+user+"'"; 51 | PreparedStatement ps=con.prepareStatement(qr); 52 | ResultSet rs=ps.executeQuery(); 53 | if(rs.next()) 54 | { 55 | %> 56 | " height="100px" width="100px" style="border-radius: 10px; margin-left: 85px 57 | ; margin-top: 20px"> 58 | 59 | <% 60 | 61 | } 62 | %> 63 |

64 |
65 | 66 | 67 |
68 |

69 |

70 | <% 71 | String username = (String)session.getAttribute("uname"); 72 | 73 | Class.forName("com.mysql.jdbc.Driver"); 74 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 75 | qr="select fname,lname,department,roll from login where username=?"; 76 | ps=con.prepareStatement(qr); 77 | ps.setString(1,username); 78 | rs=ps.executeQuery(); 79 | int t=0,p=0; 80 | // out.println(username); 81 | while(rs.next()) 82 | { 83 | String roll = rs.getString("roll"); 84 | String fname = rs.getString("fname"); 85 | String lname = rs.getString("lname"); 86 | // out.println("Pass"); 87 | String department = rs.getString("department"); 88 | 89 | %> 90 | Roll Number : 91 | <%=roll%> 92 |

93 | Name : 94 | <%=fname+" "+lname%> 95 |
96 |
97 | Department : 98 | <%=department%> 99 |

100 | <% } 101 | 102 | %> 103 |

104 | 105 | 106 |
107 |

108 |
109 |
110 | 111 | <% 112 | String faculty_name = (String) request.getParameter("faculty_name"); 113 | if(faculty_name == null) 114 | faculty_name = (String) request.getParameter("fac_name"); 115 | %> 116 |
117 | 118 | 119 | 120 | 121 | 122 |
123 | 124 |

125 | 126 | 127 |
128 | 129 | 130 | -------------------------------------------------------------------------------- /src/java/update_attendance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/update_attendance"}) 27 | public class update_attendance extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException, ClassNotFoundException, SQLException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | String course_name = (String) request.getSession().getAttribute("course_name"); 43 | String present =(String) request.getParameter("var"); 44 | String total = (String) request.getParameter("total"); 45 | if(present==null) 46 | response.sendRedirect("upload_attendance.jsp?course_name="+course_name); 47 | else 48 | { 49 | String u = request.getParameter("student_id"); 50 | String username [] = u.split(","); 51 | int b [] = new int[username.length]; 52 | for(int i=0; i 75 | /** 76 | * Handles the HTTP GET method. 77 | * 78 | * @param request servlet request 79 | * @param response servlet response 80 | * @throws ServletException if a servlet-specific error occurs 81 | * @throws IOException if an I/O error occurs 82 | */ 83 | @Override 84 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 85 | throws ServletException, IOException { 86 | try { 87 | processRequest(request, response); 88 | } catch (ClassNotFoundException ex) { 89 | Logger.getLogger(update_attendance.class.getName()).log(Level.SEVERE, null, ex); 90 | } catch (SQLException ex) { 91 | Logger.getLogger(update_attendance.class.getName()).log(Level.SEVERE, null, ex); 92 | } 93 | } 94 | 95 | /** 96 | * Handles the HTTP POST method. 97 | * 98 | * @param request servlet request 99 | * @param response servlet response 100 | * @throws ServletException if a servlet-specific error occurs 101 | * @throws IOException if an I/O error occurs 102 | */ 103 | @Override 104 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 105 | throws ServletException, IOException { 106 | try { 107 | processRequest(request, response); 108 | } catch (ClassNotFoundException ex) { 109 | Logger.getLogger(update_attendance.class.getName()).log(Level.SEVERE, null, ex); 110 | } catch (SQLException ex) { 111 | Logger.getLogger(update_attendance.class.getName()).log(Level.SEVERE, null, ex); 112 | } 113 | } 114 | 115 | /** 116 | * Returns a short description of the servlet. 117 | * 118 | * @return a String containing servlet description 119 | */ 120 | @Override 121 | public String getServletInfo() { 122 | return "Short description"; 123 | }// 124 | 125 | } 126 | -------------------------------------------------------------------------------- /web/faculty_details.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : faculty_details 3 | Created on : 13 Oct, 2018, 6:00:58 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Faculty Portal 17 | 18 | 19 | 20 | 21 | 22 | <% 23 | String user = (String)request.getParameter("username"); 24 | if(user!=null) 25 | session.setAttribute("uname", user); 26 | %> 27 |
28 |
ABC Insitute
30 |
31 | 44 |
45 |
46 | <% String username = (String)session.getAttribute("uname"); 47 | 48 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 49 | String qr="select image_path from admin where username='"+username+"'"; 50 | PreparedStatement ps=con.prepareStatement(qr); 51 | ResultSet rs=ps.executeQuery(); 52 | if(rs.next()) 53 | { 54 | %> 55 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 56 | ; margin-top: 20px"> 57 | 58 | <% 59 | 60 | } 61 | %> 62 |

63 |
64 | 65 | 66 |
67 |

68 |

69 | <% 70 | // String username = (String)session.getAttribute("uname"); 71 | 72 | Class.forName("com.mysql.jdbc.Driver"); 73 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 74 | int f =0,c=0; 75 | qr="select fname,lname,age from admin where username=?"; 76 | ps=con.prepareStatement(qr); 77 | ps.setString(1,username); 78 | rs=ps.executeQuery(); 79 | // out.println(username); 80 | while(rs.next()) 81 | { 82 | String fname = rs.getString("fname"); 83 | String lname = rs.getString("lname"); 84 | // out.println("Pass"); 85 | // String department = rs.getString("department"); 86 | int age = rs.getInt("age"); 87 | %> 88 | 89 | Name : 90 | <%=fname+" "+lname%> 91 |
92 | 96 | Age : 97 | <%=age%> 98 |

99 | <% } 100 | 101 | %> 102 |

103 | 104 | 105 |
106 |

107 |
108 | <% 109 | String status = (String)request.getParameter("status"); 110 | if(status==null) 111 | status="T"; 112 | // out.println(status); 113 | // %> 114 |
115 |
116 |
117 | <% 118 | if(status.equals("F")) 119 | // 120 | { 121 | // %> 122 | Faculty does not exist!! 123 | <% 124 | }else{ 125 | } 126 | %> 127 | 128 |
129 |
130 | 131 |
132 |
133 |
134 | 135 | 136 | -------------------------------------------------------------------------------- /web/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | To change this license header, choose License Headers in Project Properties. 3 | To change this template file, choose Tools | Templates 4 | and open the template in the editor. 5 | */ 6 | /* 7 | Created on : 16 Sep, 2018, 6:37:14 PM 8 | Author : Harsh Jain 9 | */ 10 | 11 | @charset "ISO-8859-1"; 12 | /* Split the screen in half */ 13 | .split { 14 | height: 100%; 15 | width: 50%; 16 | position: fixed; 17 | /*z-index: 1;*/ 18 | top: 0; 19 | overflow-x: hidden; 20 | overflow-y: hidden; 21 | /*padding-top: 20px;*/ 22 | } 23 | 24 | /* Control the left side */ 25 | .left { 26 | left: 0; 27 | background-color: #43425D; 28 | } 29 | 30 | /* Control the right side */ 31 | .right { 32 | right: 0; 33 | background-color: white; 34 | } 35 | 36 | /* If you want the content centered horizontally and vertically */ 37 | .centered { 38 | position: absolute; 39 | top: 50%; 40 | left: 50%; 41 | transform: translate(-50%, -50%); 42 | text-align: center; 43 | } 44 | 45 | /* Style the image inside the centered container, if needed */ 46 | .centered img { 47 | width: 150px; 48 | border-radius: 50%; 49 | } 50 | 51 | head{ 52 | display:block; 53 | } 54 | 55 | input[type=text] { 56 | width: 100%; 57 | padding: 12px 20px; 58 | margin: 8px 0; 59 | box-sizing: border-box; 60 | border: 3px solid #ccc; 61 | -webkit-transition: 0.5s; 62 | transition: 0.5s; 63 | outline: none; 64 | } 65 | 66 | input[type=text]:focus { 67 | border: 3px solid #555; 68 | } 69 | input[type=password] { 70 | width: 100%; 71 | padding: 12px 20px; 72 | margin: 8px 0; 73 | box-sizing: border-box; 74 | border: 3px solid #ccc; 75 | -webkit-transition: 0.5s; 76 | transition: 0.5s; 77 | outline: none; 78 | } 79 | input[type=password]:focus { 80 | border: 3px solid #555; 81 | } 82 | input[type=submit] { 83 | background-color: #005580; 84 | border: none; 85 | color: white; 86 | display: block; 87 | padding: 13px 40px; 88 | text-decoration: none; 89 | margin: 0 auto; 90 | cursor: pointer; 91 | border-radius: 4px; 92 | } 93 | 94 | 95 | .divide{ 96 | height: 100%; 97 | width: 20%; 98 | position: absolute; 99 | /*z-index: 1;*/ 100 | top: 0; 101 | overflow: auto; 102 | /*overflow-x: hidden;*/ 103 | overflow-y: hidden; 104 | /*padding-top: 20px;*/ 105 | } 106 | 107 | ul { 108 | list-style-type: none; 109 | margin: 0; 110 | padding: 0; 111 | width: 20%; 112 | /*margin-top: 20px;*/ 113 | background-color: #43425D; 114 | position: fixed; 115 | /*color: white;*/ 116 | height: 100%; 117 | overflow: auto; 118 | } 119 | 120 | li a { 121 | display: block; 122 | color: white; 123 | height: 40px; 124 | padding-top: 16px; 125 | /*padding-bottom: 14px;*/ 126 | 127 | /*padding: 8px 16px;*/ 128 | font-family: sans-serif; 129 | text-align: center; 130 | text-decoration: none; 131 | } 132 | 133 | li a.active { 134 | background-color: black; 135 | opacity: 0.2; 136 | filter: alpha(opacity=20); 137 | color: white; 138 | } 139 | 140 | li a:hover:not(.active) { 141 | background-color: #555; 142 | color: white; 143 | } 144 | 145 | 146 | .facutly_info_right{ 147 | background-color: #cccccc; 148 | right: 0; 149 | display: block; 150 | } 151 | img.center{ 152 | /* border-radius: 50%;*/ 153 | align-items: center; 154 | display: block; 155 | max-width:180px; 156 | max-height:180px; 157 | width: auto; 158 | margin-top:15px; 159 | /*display: block;*/ 160 | margin-left: auto; 161 | margin-right: auto; 162 | height: auto; 163 | } 164 | 165 | p.facutly_info{ 166 | color :#005580; 167 | font-family: sans-serif; 168 | font-size: 20px; 169 | margin: 10px; 170 | } 171 | 172 | .center_display{ 173 | position: fixed; 174 | top: 50%; 175 | left: 60%; 176 | overflow: auto; 177 | font-family: cursive; 178 | display: block; 179 | transform: translate(-50%, -50%); 180 | text-align: center; 181 | } 182 | 183 | 184 | 185 | 186 | /*the container must be positioned relative:*/ 187 | .custom-select { 188 | position: relative; 189 | font-family: Arial; 190 | } 191 | .custom-select select { 192 | display: none; /*hide original SELECT element:*/ 193 | } 194 | .select-selected { 195 | background-color: DodgerBlue; 196 | } 197 | /*style the arrow inside the select element:*/ 198 | .select-selected:after { 199 | position: absolute; 200 | content: ""; 201 | top: 14px; 202 | right: 10px; 203 | width: 0; 204 | height: 0; 205 | border: 6px solid transparent; 206 | border-color: #fff transparent transparent transparent; 207 | } 208 | /*point the arrow upwards when the select box is open (active):*/ 209 | .select-selected.select-arrow-active:after { 210 | border-color: transparent transparent #fff transparent; 211 | top: 7px; 212 | } 213 | /*style the items (options), including the selected item:*/ 214 | .select-items div,.select-selected { 215 | color: #ffffff; 216 | padding: 8px 16px; 217 | border: 1px solid transparent; 218 | border-color: transparent transparent rgba(0, 0, 0, 0.1) transparent; 219 | cursor: pointer; 220 | /*user-select: none;*/ 221 | } 222 | /*style items (options):*/ 223 | .select-items { 224 | position: absolute; 225 | background-color: DodgerBlue; 226 | top: 100%; 227 | left: 0; 228 | right: 0; 229 | z-index: 99; 230 | } 231 | /*hide the items when the select box is closed:*/ 232 | .select-hide { 233 | display: none; 234 | } 235 | .select-items div:hover, .same-as-selected { 236 | background-color: rgba(0, 0, 0, 0.1); 237 | } -------------------------------------------------------------------------------- /web/student_details.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : student_details 3 | Created on : 7 Oct, 2018, 6:05:01 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Faculty Portal 17 | 18 | 19 | 20 | 21 | 22 | <% 23 | String user = (String)request.getParameter("username"); 24 | if(user!=null) 25 | session.setAttribute("uname", user); 26 | %> 27 |
28 |
ABC Insitute
30 |
31 | 44 |
45 |
46 | <% String username = (String)session.getAttribute("uname"); 47 | 48 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 49 | String qr="select image_path from admin where username='"+username+"'"; 50 | PreparedStatement ps=con.prepareStatement(qr); 51 | ResultSet rs=ps.executeQuery(); 52 | if(rs.next()) 53 | { 54 | %> 55 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 56 | ; margin-top: 20px"> 57 | 58 | <% 59 | 60 | } 61 | %> 62 |

63 |
64 | 65 | 66 |
67 |

68 |

69 | <% 70 | // String username = (String)session.getAttribute("uname"); 71 | 72 | Class.forName("com.mysql.jdbc.Driver"); 73 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 74 | int f =0,c=0; 75 | qr="select fname,lname,age from admin where username=?"; 76 | ps=con.prepareStatement(qr); 77 | ps.setString(1,username); 78 | rs=ps.executeQuery(); 79 | // out.println(username); 80 | while(rs.next()) 81 | { 82 | String fname = rs.getString("fname"); 83 | String lname = rs.getString("lname"); 84 | // out.println("Pass"); 85 | // String department = rs.getString("department"); 86 | int age = rs.getInt("age"); 87 | %> 88 | 89 | Name : 90 | <%=fname+" "+lname%> 91 |
92 | 96 | Age : 97 | <%=age%> 98 |

99 | <% } 100 | 101 | %> 102 |

103 | 104 | 105 |
106 |

107 |
<% 108 | String status = (String)request.getParameter("status"); 109 | if(status==null) 110 | status="T"; 111 | // out.println(status); 112 | // %> 113 |
114 |
115 |
116 | 117 | <% 118 | if(status.equals("F")) 119 | // 120 | { 121 | // %> 122 | Student does not exist!! 123 | <% 124 | }else{ 125 | } 126 | %> 127 | 128 |
129 |
130 | 131 |
132 |
133 |
134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /src/java/courseRegister.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/courseRegister"}) 27 | public class courseRegister extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | String course_name = (String) request.getParameter("course_name"); 43 | String course_id = (String) request.getParameter("course_id"); 44 | String faculty_username = (String) request.getParameter("faculty_username"); 45 | Class.forName("com.mysql.jdbc.Driver"); 46 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 47 | String qr="select course_id from courses"; 48 | PreparedStatement ps=con.prepareStatement(qr); 49 | ResultSet rs=ps.executeQuery(); 50 | while(rs.next()) 51 | { 52 | if(rs.getString("course_id").equals(course_id)) 53 | { 54 | response.sendRedirect("course_register.jsp?status=CID"); 55 | return; 56 | } 57 | } 58 | qr="select course_name from courses"; 59 | ps=con.prepareStatement(qr); 60 | rs=ps.executeQuery(); 61 | while(rs.next()) 62 | { 63 | if(rs.getString("course_name").equals(course_name)) 64 | { 65 | response.sendRedirect("course_register.jsp?status=CNAME"); 66 | return; 67 | } 68 | }qr="select username from login"; 69 | ps=con.prepareStatement(qr); 70 | rs=ps.executeQuery(); 71 | while(rs.next()) 72 | { 73 | if(rs.getString("username").equals(faculty_username)) 74 | { 75 | qr="insert into courses(username,course_id,course_name) values(?,?,?)"; 76 | ps=con.prepareStatement(qr); 77 | ps.setString(1,faculty_username); 78 | ps.setString(2,course_id); 79 | ps.setString(3,course_name); 80 | ps.executeUpdate(); 81 | response.sendRedirect("course_register.jsp"); 82 | return; 83 | } 84 | else 85 | response.sendRedirect("course_register.jsp?status=UNAME"); 86 | return; 87 | } 88 | 89 | } catch (ClassNotFoundException | SQLException ex) { 90 | Logger.getLogger(courseRegister.class.getName()).log(Level.SEVERE, null, ex); 91 | } 92 | } 93 | 94 | // 95 | /** 96 | * Handles the HTTP GET method. 97 | * 98 | * @param request servlet request 99 | * @param response servlet response 100 | * @throws ServletException if a servlet-specific error occurs 101 | * @throws IOException if an I/O error occurs 102 | */ 103 | @Override 104 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 105 | throws ServletException, IOException { 106 | processRequest(request, response); 107 | } 108 | 109 | /** 110 | * Handles the HTTP POST method. 111 | * 112 | * @param request servlet request 113 | * @param response servlet response 114 | * @throws ServletException if a servlet-specific error occurs 115 | * @throws IOException if an I/O error occurs 116 | */ 117 | @Override 118 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 119 | throws ServletException, IOException { 120 | processRequest(request, response); 121 | } 122 | 123 | /** 124 | * Returns a short description of the servlet. 125 | * 126 | * @return a String containing servlet description 127 | */ 128 | @Override 129 | public String getServletInfo() { 130 | return "Short description"; 131 | }// 132 | 133 | } 134 | -------------------------------------------------------------------------------- /web/faculty_marks.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : faculty_marks 3 | Created on : 17 Sep, 2018, 9:10:37 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Upload Marks 17 | 18 | 31 | 32 | 33 | 34 |
35 |
ABC Insitute
37 |
38 | 47 |
48 |
49 | 50 | 67 |

68 | 69 |
70 |
71 | <% // String username = (String)session.getAttribute("uname"); 72 | 73 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 74 | qr="select image_path from login where username='"+username+"'"; 75 | ps=con.prepareStatement(qr); 76 | rs=ps.executeQuery(); 77 | if(rs.next()) 78 | { 79 | %> 80 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 81 | ; margin-top: 20px"> 82 | 83 | <% 84 | 85 | } 86 | %> 87 |

88 |
89 | 90 | 91 |
92 |

93 |

94 | <% 95 | // String username = (String)session.getAttribute("uname"); 96 | 97 | Class.forName("com.mysql.jdbc.Driver"); 98 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 99 | qr="select fname,lname,department,age from login where username=?"; 100 | ps=con.prepareStatement(qr); 101 | ps.setString(1,username); 102 | rs=ps.executeQuery(); 103 | // out.println(username); 104 | while(rs.next()) 105 | { 106 | String fname = rs.getString("fname"); 107 | String lname = rs.getString("lname"); 108 | // out.println("Pass"); 109 | String department = rs.getString("department"); 110 | int age = rs.getInt("age"); 111 | %> 112 | 113 | Name : 114 | <%=fname+" "+lname%> 115 |
116 |
117 | Department : 118 | <%=department%> 119 |

120 | Age : 121 | <%=age%> 122 |

123 | <% } 124 | 125 | %> 126 |

127 | 128 | 129 |
130 |

131 |
132 | 133 | -------------------------------------------------------------------------------- /web/update_faculty_details.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : update_faculty_details 3 | Created on : 18 Sep, 2018, 8:29:47 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 8 | 9 | 10 | 11 | 12 | JSP Page 13 | 14 | 15 | 16 |
17 |
ABC Insitute
19 |
20 |
30 | 31 |
32 |

ABC institute

33 |

Please Submit your latest information

34 |
35 |
36 | Last Name :
37 | 38 | Department Name :
39 | 54 |
55 | 56 | 130 | 131 |
132 |
133 |   136 | Forget password

137 | 138 |
139 |
140 | 141 | 142 | -------------------------------------------------------------------------------- /web/faculty_attendance.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : faculty_attendance 3 | Created on : 17 Sep, 2018, 9:10:06 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.PreparedStatement"%> 8 | <%@page import="java.sql.DriverManager"%> 9 | <%@page import="java.sql.Connection"%> 10 | <%@page import="java.sql.ResultSet"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Upload Attendance 17 | 18 | 31 | 32 | 33 | 34 |
35 |
ABC Insitute
37 |
38 | 49 |
50 |
51 | 52 | 69 |

70 | 71 |
72 |
73 | <% // String username = (String)session.getAttribute("uname"); 74 | 75 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 76 | qr="select image_path from login where username='"+username+"'"; 77 | ps=con.prepareStatement(qr); 78 | rs=ps.executeQuery(); 79 | if(rs.next()) 80 | { 81 | %> 82 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 83 | ; margin-top: 20px"> 84 | 85 | <% 86 | 87 | } 88 | %> 89 |

90 |
91 | 92 | 93 |
94 |

95 |

96 | <% 97 | username = (String)session.getAttribute("uname"); 98 | 99 | Class.forName("com.mysql.jdbc.Driver"); 100 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 101 | qr="select fname,lname,department,age from login where username=?"; 102 | ps=con.prepareStatement(qr); 103 | ps.setString(1,username); 104 | rs=ps.executeQuery(); 105 | // out.println(username); 106 | while(rs.next()) 107 | { 108 | String fname = rs.getString("fname"); 109 | String lname = rs.getString("lname"); 110 | // out.println("Pass"); 111 | String department = rs.getString("department"); 112 | int age = rs.getInt("age"); 113 | %> 114 | 115 | Name : 116 | <%=fname+" "+lname%> 117 |
118 |
119 | Department : 120 | <%=department%> 121 |

122 | Age : 123 | <%=age%> 124 |

125 | <% } 126 | 127 | %> 128 |

129 | 130 | 131 |
132 |

133 |
134 | 135 | 136 | -------------------------------------------------------------------------------- /web/notices.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : notices 3 | Created on : 13 Oct, 2018, 6:18:02 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.DriverManager"%> 8 | <%@page import="java.sql.ResultSet"%> 9 | <%@page import="java.sql.PreparedStatement"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Upload Notices 17 | 18 | 39 | 40 | 41 |
42 |
ABC Insitute
44 |
45 | 46 | 58 | 59 |
60 |
61 | <% String username = (String)session.getAttribute("uname"); 62 | 63 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 64 | String qr="select image_path from admin where username='"+username+"'"; 65 | PreparedStatement ps=con.prepareStatement(qr); 66 | ResultSet rs=ps.executeQuery(); 67 | if(rs.next()) 68 | { 69 | %> 70 | " height="100px" width="100px"style="border-radius: 10px; margin-left: 85px 71 | ; margin-top: 20px"> 72 | 73 | <% 74 | 75 | } 76 | %> 77 |

78 |
79 | 80 | 81 |
82 |

83 |

84 | <% 85 | 86 | Class.forName("com.mysql.jdbc.Driver"); 87 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 88 | int f =0,c=0; 89 | qr="select fname,lname,age from admin where username=?"; 90 | ps=con.prepareStatement(qr); 91 | ps.setString(1,username); 92 | rs=ps.executeQuery(); 93 | // out.println(username); 94 | while(rs.next()) 95 | { 96 | String fname = rs.getString("fname"); 97 | String lname = rs.getString("lname"); 98 | // out.println("Pass"); 99 | // String department = rs.getString("department"); 100 | int age = rs.getInt("age"); 101 | %> 102 | 103 | Name : 104 | <%=fname+" "+lname%> 105 |
106 | 110 | Age : 111 | <%=age%> 112 |

113 | <% } 114 | 115 | %> 116 |

117 | 118 | 119 |
120 |

121 |
122 |
123 | 124 | 125 | 126 | <% 127 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 128 | qr="select image_path from notices"; 129 | ps=con.prepareStatement(qr); 130 | rs=ps.executeQuery(); 131 | while(rs.next()) 132 | { 133 | %> 134 | 135 | 137 | 138 | 139 | 140 | <% 141 | 142 | } 143 | %> 144 |
Notice
136 | " height="600px" width="500px">" style="width: 0px">
145 |
146 | 147 | -------------------------------------------------------------------------------- /web/update_student_image.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : update_student_image 3 | Created on : 10 Oct, 2018, 5:44:52 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | Student Home 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | <% 30 | String user = (String)request.getParameter("username"); 31 | if(user!=null) 32 | session.setAttribute("uname", user); 33 | %> 34 |
35 |
ABC Insitute
37 |
38 | 49 |
50 |
51 | 52 | <% 53 | user = (String) session.getAttribute("uname"); 54 | session.setAttribute("student_username",user); 55 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 56 | String qr="select imagepath from login where username='"+user+"'"; 57 | PreparedStatement ps=con.prepareStatement(qr); 58 | ResultSet rs=ps.executeQuery(); 59 | if(rs.next()) 60 | { 61 | %> 62 | " height="100px" width="100px" style="border-radius: 10px; margin-left: 85px 63 | ; margin-top: 20px"> 64 | 65 | <% 66 | 67 | } 68 | %> 69 |

70 |
71 | 72 | 73 |
74 |

75 |
76 | 77 | 78 |
79 |

80 |

81 | <% 82 | String username = (String)session.getAttribute("uname"); 83 | session.setAttribute("student_username",username); 84 | Class.forName("com.mysql.jdbc.Driver"); 85 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 86 | qr="select fname,lname,department,roll from login where username=?"; 87 | ps=con.prepareStatement(qr); 88 | ps.setString(1,username); 89 | rs=ps.executeQuery(); 90 | int t=0,p=0; 91 | // out.println(username); 92 | while(rs.next()) 93 | { 94 | String roll = rs.getString("roll"); 95 | String fname = rs.getString("fname"); 96 | String lname = rs.getString("lname"); 97 | // out.println("Pass"); 98 | String department = rs.getString("department"); 99 | 100 | %> 101 | Roll Number : 102 | <%=roll%> 103 |

104 | Name : 105 | <%=fname+" "+lname%> 106 |
107 |
108 | Department : 109 | <%=department%> 110 |

111 | <% } 112 | 113 | %> 114 |

115 | 116 | 117 |
118 |

119 |
120 | <% 121 | qr="select attended,course_name,course_id,total from courses where username=?"; 122 | ps=con.prepareStatement(qr); 123 | ps.setString(1,username); 124 | rs=ps.executeQuery(); 125 | // out.println(username); 126 | while(rs.next()) 127 | { 128 | int attended = rs.getInt("attended"); 129 | String course_name = rs.getString("course_name"); 130 | String course_id = rs.getString("course_id"); 131 | // out.println("Pass"); 132 | int total = rs.getInt("total"); 133 | p = p + attended; 134 | t = t + total; 135 | 136 | 137 | } 138 | session.setAttribute("A", "SS"); 139 | %> 140 |
141 |
142 | 143 | 144 |
145 |
146 | 147 | 148 | -------------------------------------------------------------------------------- /src/java/upload_notice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | import java.sql.Connection; 11 | import java.sql.DriverManager; 12 | import java.sql.Statement; 13 | import java.util.Iterator; 14 | import java.util.List; 15 | import javax.servlet.ServletException; 16 | import javax.servlet.annotation.WebServlet; 17 | import javax.servlet.http.HttpServlet; 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | import org.apache.commons.fileupload.FileItem; 21 | import org.apache.commons.fileupload.FileItemFactory; 22 | import org.apache.commons.fileupload.FileUploadException; 23 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; 24 | import org.apache.commons.fileupload.servlet.ServletFileUpload; 25 | 26 | /** 27 | * 28 | * @author Harsh Jain 29 | */ 30 | @WebServlet(urlPatterns = {"/upload_notice"}) 31 | public class upload_notice extends HttpServlet { 32 | 33 | /** 34 | * Processes requests for both HTTP GET and POST 35 | * methods. 36 | * 37 | * @param request servlet request 38 | * @param response servlet response 39 | * @throws ServletException if a servlet-specific error occurs 40 | * @throws IOException if an I/O error occurs 41 | */ 42 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 43 | throws ServletException, IOException { 44 | response.setContentType("text/html;charset=UTF-8"); 45 | try (PrintWriter out = response.getWriter()) { 46 | try 47 | { 48 | String ImageFile=""; 49 | String itemName = ""; 50 | boolean isMultipart = ServletFileUpload.isMultipartContent(request); 51 | if (!isMultipart) 52 | { 53 | } 54 | else 55 | { 56 | FileItemFactory factory = new DiskFileItemFactory(); 57 | ServletFileUpload upload = new ServletFileUpload(factory); 58 | List items = null; 59 | try 60 | { 61 | items = upload.parseRequest(request); 62 | } 63 | catch (FileUploadException e) 64 | { 65 | e.getMessage(); 66 | } 67 | Iterator itr = items.iterator(); 68 | while (itr.hasNext()) 69 | { 70 | FileItem item = (FileItem) itr.next(); 71 | if (item.isFormField()) 72 | { 73 | String name = item.getFieldName(); 74 | String value = item.getString(); 75 | if(name.equals("ImageFile")) 76 | { 77 | ImageFile=value; 78 | } 79 | 80 | } 81 | else 82 | { 83 | try 84 | { 85 | itemName = item.getName(); 86 | File savedFile = new File(getServletConfig().getServletContext().getRealPath("/")+"images\\"+itemName); 87 | item.write(savedFile); 88 | } 89 | catch (Exception e) 90 | { 91 | out.println("Errorasfdsgsdg"+e.getMessage()); 92 | } 93 | } 94 | } 95 | try 96 | { 97 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login","root","root"); 98 | Statement st = con.createStatement(); 99 | st.executeUpdate("insert into notices(image_path) values ('"+itemName+"')"); 100 | } 101 | catch(Exception el) 102 | { 103 | out.println("Inserting error"+el.getMessage()); 104 | } 105 | } 106 | } 107 | catch (Exception e){ 108 | out.println(e.getMessage()); 109 | } 110 | response.sendRedirect("faculty_notice.jsp"); 111 | } 112 | } 113 | 114 | // 115 | /** 116 | * Handles the HTTP GET method. 117 | * 118 | * @param request servlet request 119 | * @param response servlet response 120 | * @throws ServletException if a servlet-specific error occurs 121 | * @throws IOException if an I/O error occurs 122 | */ 123 | @Override 124 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 125 | throws ServletException, IOException { 126 | processRequest(request, response); 127 | } 128 | 129 | /** 130 | * Handles the HTTP POST method. 131 | * 132 | * @param request servlet request 133 | * @param response servlet response 134 | * @throws ServletException if a servlet-specific error occurs 135 | * @throws IOException if an I/O error occurs 136 | */ 137 | @Override 138 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 139 | throws ServletException, IOException { 140 | processRequest(request, response); 141 | } 142 | 143 | /** 144 | * Returns a short description of the servlet. 145 | * 146 | * @return a String containing servlet description 147 | */ 148 | @Override 149 | public String getServletInfo() { 150 | return "Short description"; 151 | }// 152 | 153 | } 154 | -------------------------------------------------------------------------------- /src/java/login.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | import java.io.IOException; 8 | import java.io.PrintWriter; 9 | import java.sql.Connection; 10 | import java.sql.DriverManager; 11 | import java.sql.PreparedStatement; 12 | import java.sql.ResultSet; 13 | import java.sql.SQLException; 14 | import java.util.logging.Level; 15 | import java.util.logging.Logger; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * 24 | * @author Harsh Jain 25 | */ 26 | @WebServlet(urlPatterns = {"/login"}) 27 | public class login extends HttpServlet { 28 | 29 | /** 30 | * Processes requests for both HTTP GET and POST 31 | * methods. 32 | * 33 | * @param request servlet request 34 | * @param response servlet response 35 | * @throws ServletException if a servlet-specific error occurs 36 | * @throws IOException if an I/O error occurs 37 | */ 38 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | response.setContentType("text/html;charset=UTF-8"); 41 | try (PrintWriter out = response.getWriter()) { 42 | String type_of_login = request.getParameter("type_of_login"); 43 | if(type_of_login==null) 44 | { 45 | type_of_login="5"; 46 | } 47 | if(type_of_login.equals("1")) 48 | { 49 | String username = request.getParameter("username"); 50 | String password = request.getParameter("password"); 51 | Class.forName("com.mysql.jdbc.Driver"); 52 | 53 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 54 | String qr="select username,password from login where username=? and password=?"; 55 | PreparedStatement ps=con.prepareStatement(qr); 56 | ps.setString(1,username); 57 | ps.setString(2,password); 58 | 59 | ResultSet rs=ps.executeQuery(); 60 | // out.print(password); 61 | if(rs.next()) 62 | response.sendRedirect("faculty_home.jsp?username="+username); 63 | else 64 | response.sendRedirect("index.jsp?status="+"F"); 65 | 66 | } 67 | else if (type_of_login.equals("0")) 68 | { 69 | String username = request.getParameter("username"); 70 | String password = request.getParameter("password"); 71 | Class.forName("com.mysql.jdbc.Driver"); 72 | 73 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login", "root", "root"); 74 | String qr="select * from login where username=? and password=?"; 75 | PreparedStatement ps=con.prepareStatement(qr); 76 | ps.setString(1,username); 77 | ps.setString(2,password); 78 | ResultSet rs=ps.executeQuery(); 79 | // out.print(password); 80 | if(rs.next()) 81 | { 82 | response.sendRedirect("student_home.jsp?username="+username); 83 | }else 84 | response.sendRedirect("index.jsp?status="+"F"); 85 | } 86 | else if(type_of_login.equals("2")){ 87 | String username = request.getParameter("username"); 88 | String password = request.getParameter("password"); 89 | Class.forName("com.mysql.jdbc.Driver"); 90 | 91 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/faculty_login", "root", "root"); 92 | String qr="select * from admin where username=? and password=?"; 93 | PreparedStatement ps=con.prepareStatement(qr); 94 | ps.setString(1,username); 95 | ps.setString(2,password); 96 | ResultSet rs=ps.executeQuery(); 97 | // out.print(password); 98 | if(rs.next()) 99 | { 100 | response.sendRedirect("admin_home.jsp?username="+username); 101 | } else 102 | response.sendRedirect("index.jsp?status="+"F"); 103 | 104 | 105 | }else 106 | response.sendRedirect("index.jsp?status="+"L"); 107 | 108 | } catch (ClassNotFoundException | SQLException ex) { 109 | Logger.getLogger(login.class.getName()).log(Level.SEVERE, null, ex); 110 | } 111 | } 112 | 113 | // 114 | /** 115 | * Handles the HTTP GET method. 116 | * 117 | * @param request servlet request 118 | * @param response servlet response 119 | * @throws ServletException if a servlet-specific error occurs 120 | * @throws IOException if an I/O error occurs 121 | */ 122 | @Override 123 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 124 | throws ServletException, IOException { 125 | processRequest(request, response); 126 | } 127 | 128 | /** 129 | * Handles the HTTP POST method. 130 | * 131 | * @param request servlet request 132 | * @param response servlet response 133 | * @throws ServletException if a servlet-specific error occurs 134 | * @throws IOException if an I/O error occurs 135 | */ 136 | @Override 137 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 138 | throws ServletException, IOException { 139 | processRequest(request, response); 140 | } 141 | 142 | /** 143 | * Returns a short description of the servlet. 144 | * 145 | * @return a String containing servlet description 146 | */ 147 | @Override 148 | public String getServletInfo() { 149 | return "Short description"; 150 | }// 151 | 152 | } 153 | -------------------------------------------------------------------------------- /web/student_marks.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : student_marks 3 | Created on : 17 Oct, 2018, 12:59:40 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 12 | 13 | 14 | 15 | 16 | JSP Page 17 | 18 | 39 | 40 | 41 | <% 42 | String user = (String)request.getParameter("username"); 43 | if(user!=null) 44 | session.setAttribute("uname", user); 45 | %> 46 |
47 |
ABC Insitute
49 |
50 | 61 |
62 |
63 | <% 64 | user = (String) session.getAttribute("uname"); 65 | 66 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 67 | String qr="select imagepath from login where username='"+user+"'"; 68 | PreparedStatement ps=con.prepareStatement(qr); 69 | ResultSet rs=ps.executeQuery(); 70 | if(rs.next()) 71 | { 72 | %> 73 | " height="100px" width="100px" style="border-radius: 10px; margin-left: 85px 74 | ; margin-top: 20px"> 75 | 76 | <% 77 | 78 | } 79 | %> 80 |

81 |
82 | 83 | 84 |
85 |

86 |

87 | <% 88 | String username = (String)session.getAttribute("uname"); 89 | 90 | Class.forName("com.mysql.jdbc.Driver"); 91 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 92 | qr="select fname,lname,department,roll from login where username=?"; 93 | ps=con.prepareStatement(qr); 94 | ps.setString(1,username); 95 | rs=ps.executeQuery(); 96 | // out.println(username); 97 | while(rs.next()) 98 | { 99 | String roll = rs.getString("roll"); 100 | String fname = rs.getString("fname"); 101 | String lname = rs.getString("lname"); 102 | // out.println("Pass"); 103 | String department = rs.getString("department"); 104 | 105 | %> 106 | Roll Number : 107 | <%=roll%> 108 |

109 | Name : 110 | <%=fname+" "+lname%> 111 |
112 |
113 | Department : 114 | <%=department%> 115 |

116 | <% } 117 | 118 | %> 119 |

120 | 121 | 122 |
123 |

124 |
125 |
126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | <%Class.forName("com.mysql.jdbc.Driver"); 134 | // Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 135 | qr="select course_name,course_id,marks from courses where username=?"; 136 | ps=con.prepareStatement(qr); 137 | ps.setString(1,username); 138 | rs=ps.executeQuery(); 139 | // out.println(username); 140 | while(rs.next()) 141 | { 142 | // int attended = rs.getInt("attended"); 143 | String course_name = rs.getString("course_name"); 144 | String course_id = rs.getString("course_id"); 145 | int marks = rs.getInt("marks"); 146 | // out.println("Pass"); 147 | // int total = rs.getInt("total"); 148 | %> 149 | 150 | 151 | 154 | 157 | 160 | 161 | 162 | 163 | 164 | <% 165 | 166 | }%> 167 |
Course NameCourse IDMarks
152 | <%=course_name%> 153 | 155 | <%=course_id%> 156 | 158 | <%=marks%> 159 |
168 | 169 |
170 | 171 | 172 | -------------------------------------------------------------------------------- /web/student_home.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Document : student_home 3 | Created on : 17 Sep, 2018, 7:54:45 PM 4 | Author : Harsh Jain 5 | --%> 6 | 7 | <%@page import="java.sql.ResultSet"%> 8 | <%@page import="java.sql.PreparedStatement"%> 9 | <%@page import="java.sql.DriverManager"%> 10 | <%@page import="java.sql.Connection"%> 11 | <%@page import="java.sql.Connection"%> 12 | <%@page contentType="text/html" pageEncoding="UTF-8"%> 13 | 14 | 15 | 16 | 17 | Student Home 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | <% 31 | String user = (String)request.getParameter("username"); 32 | if(user!=null) 33 | session.setAttribute("uname", user); 34 | %> 35 |
36 |
ABC Insitute
38 |
39 | 48 |
49 |
50 | <% 51 | user = (String) session.getAttribute("uname"); 52 | Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 53 | String qr="select imagepath from login where username='"+user+"'"; 54 | PreparedStatement ps=con.prepareStatement(qr); 55 | ResultSet rs=ps.executeQuery(); 56 | if(rs.next()) 57 | { 58 | %> 59 | " height="100px" width="100px" style="border-radius: 10px; margin-left: 85px 60 | ; margin-top: 20px"> 61 | 62 | <% 63 | 64 | } 65 | %> 66 |

67 |
68 | 69 | 70 |
71 |

72 |

73 | <% 74 | String username = (String)session.getAttribute("uname"); 75 | 76 | Class.forName("com.mysql.jdbc.Driver"); 77 | con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_login","root","root"); 78 | qr="select fname,lname,department,roll from login where username=?"; 79 | ps=con.prepareStatement(qr); 80 | ps.setString(1,username); 81 | rs=ps.executeQuery(); 82 | int t=0,p=0; 83 | // out.println(username); 84 | while(rs.next()) 85 | { 86 | String roll = rs.getString("roll"); 87 | String fname = rs.getString("fname"); 88 | String lname = rs.getString("lname"); 89 | // out.println("Pass"); 90 | String department = rs.getString("department"); 91 | 92 | %> 93 | Roll Number : 94 | <%=roll%> 95 |

96 | Name : 97 | <%=fname+" "+lname%> 98 |
99 |
100 | Department : 101 | <%=department%> 102 |

103 | <% } 104 | 105 | %> 106 |

107 | 108 | 109 |
110 |

111 |
112 | <% 113 | qr="select attended,course_name,course_id,total from courses where username=?"; 114 | ps=con.prepareStatement(qr); 115 | ps.setString(1,username); 116 | rs=ps.executeQuery(); 117 | // out.println(username); 118 | while(rs.next()) 119 | { 120 | int attended = rs.getInt("attended"); 121 | String course_name = rs.getString("course_name"); 122 | String course_id = rs.getString("course_id"); 123 | // out.println("Pass"); 124 | int total = rs.getInt("total"); 125 | p = p + attended; 126 | t = t + total; 127 | 128 | 129 | } 130 | 131 | %> 132 |
133 | <% 134 | try{ 135 | if(p*100/t<75) 136 | { 137 | %> 138 |

Not Eligible to give your examinations!!!!

139 | 140 |
141 |
142 | <% 143 | } 144 | else 145 | { 146 | %> 147 |

Eligible to give Examinations!!!

148 |
149 |
150 | 151 | <% 152 | } 153 | %> 154 | 160 | 161 | <% 162 | } catch(ArithmeticException e) 163 | { 164 | %>

Please Register for a Course!!!

165 |
166 | 167 | <% } 168 | %> 169 |
170 | 171 | 172 | --------------------------------------------------------------------------------