%--
Document : Register
Created on : 3 Sept 2024, 11:47:28 am
Author : shaad
--%>
<%@page contentType="text/html" import="java.sql.*" pageEncoding="UTF-8"%>
Registration JSP Page
Registration JSP Page
<%
String uname = request.getParameter("t1");
String pass1 = request.getParameter("tp1");
String pass2 = request.getParameter("tp2");
String email = request.getParameter("email");
String country = request.getParameter("country");
if(pass1.equals(pass2))
{
try {
Connection con = DriverManager.getConnection(url);
PreparedStatement stmt = con.prepareStatement("insert into user values(?, ?, ?, ?)");
stmt.setString(1, uname);
stmt.setString(2, pass1);
stmt.setString(3, email);
stmt.setString(4, country);
int row = stmt.executeUpdate();
if (row == 1)
out.println("Registration is successful!");
else
out.println("Registration failed!");
}
catch(Exception e)
{
out.println(e);
}
%>
<%
}
else
{
out.println("Password Mismatch");
%>
<%
}
%>