@@ -44,34 +44,38 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
44
44
String a3 = confirmUserPassword ;
45
45
String a4 = participantsName ;
46
46
47
- // if(){
48
- // }else{
49
- // }
50
-
51
- if (a2 .equals (a3 )){
52
-
53
- try {
54
- Class .forName ("com.mysql.cj.jdbc.Driver" );
55
- String conURL = "jdbc:mysql://localhost:3306/EventlyDB" ;
56
- String dbusername = "root" ;
57
- String dbuserpassword = "abc" ;
58
- Connection con ;
59
- con = DriverManager .getConnection (conURL , dbusername , dbuserpassword );
60
- Statement statement = con .createStatement ();
61
- String mysqlQuery = "insert into plogindetails values('" +a1 +"','" +a2 +"','" +a4 +"')" ;
62
- statement .executeUpdate (mysqlQuery );
63
- RequestDispatcher requestDispatcher ;
64
- requestDispatcher = request .getRequestDispatcher ("Plogin.html" );
65
- requestDispatcher .forward (request , response );
66
- con .close ();
67
- }catch (ServletException | IOException | ClassNotFoundException | SQLException e ){
68
- System .out .println (e );
69
- }
70
-
71
- }else {
72
- out .println ("<center><h1>!! Please Enter Password And Confirm Password Same !!</h1><center>" );
47
+ if (a1 .isBlank () && a2 .isBlank () && a3 .isBlank () && a4 .isBlank ()){
48
+ response .setContentType ("text/html" );
49
+ out .println ("<script type=\" text/javascript\" >" );
50
+ out .println ("alert('Please Enter Your Details!!!');" );
51
+ out .println ("</script>" );
73
52
RequestDispatcher requestDispatcher = request .getRequestDispatcher ("Psignup.html" );
74
53
requestDispatcher .include (request , response );
54
+ }else {
55
+ if (a2 .equals (a3 )){
56
+ try {
57
+ Class .forName ("com.mysql.cj.jdbc.Driver" );
58
+ String conURL = "jdbc:mysql://localhost:3306/EventlyDB" ;
59
+ String dbusername = "root" ;
60
+ String dbuserpassword = "abc" ;
61
+ Connection con ;
62
+ con = DriverManager .getConnection (conURL , dbusername , dbuserpassword );
63
+ Statement statement = con .createStatement ();
64
+ String mysqlQuery = "insert into plogindetails values('" +a1 +"','" +a2 +"','" +a4 +"')" ;
65
+ statement .executeUpdate (mysqlQuery );
66
+ RequestDispatcher requestDispatcher ;
67
+ requestDispatcher = request .getRequestDispatcher ("Plogin.html" );
68
+ requestDispatcher .forward (request , response );
69
+ con .close ();
70
+ }catch (ServletException | IOException | ClassNotFoundException | SQLException e ){
71
+ System .out .println (e );
72
+ }
73
+ }else {
74
+ out .println ("<center><h1>!! Please Enter Password And Confirm Password Same !!</h1><center>" );
75
+ RequestDispatcher requestDispatcher = request .getRequestDispatcher ("Psignup.html" );
76
+ requestDispatcher .include (request , response );
77
+ }
78
+
75
79
}
76
80
77
81
}
0 commit comments