├── 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 |
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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }//
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 |
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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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 | // 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 | }// 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; iGET 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 |
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 |
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 |
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 |
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 |
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 | // 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 | }//
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 |
Login Portal
107 | <% 108 | String status = (String)request.getParameter("status"); 109 | if(status==null) 110 | status="T"; 111 | %> 112 | 137 |
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 |