-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewAlumnusRegistration.java
50 lines (39 loc) · 1.87 KB
/
NewAlumnusRegistration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class NewAlumnusRegistration extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
request.getRequestDispatcher("AlumniLogin.html").include(request, response);
try {
Connection con = Database.initializeDatabase();
PreparedStatement st;
st = con.prepareStatement("Insert into alumni details");
st.setString(1, request.getParameter("name"));
st.setString(2, request.getParameter("email"));
st.setString(3, request.getParameter("course"));
st.setString(4, request.getParameter("branch"));
st.setString(5, request.getParameter("PRN"));
st.setString(6, request.getParameter("organization"));
st.setString(7, request.getParameter("designation"));
st.setString(8, request.getParameter("password"));
st.executeUpdate();
}
catch (Exception e) {
e.printStackTrace();
}
out.close();
}
}