diff --git a/nb-configuration.xml b/nb-configuration.xml new file mode 100644 index 0000000..12d206d --- /dev/null +++ b/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + 9.0-web + Tomcat + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c5bbbce --- /dev/null +++ b/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + com.mycompany + mavenproject3 + 1.0-SNAPSHOT + war + + mavenproject3 + + + ${project.build.directory}/endorsed + UTF-8 + + + + + javax + javaee-web-api + 7.0 + provided + + + mysql + mysql-connector-java + 8.0.30 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + javax + javaee-endorsed-api + 7.0 + jar + + + + + + + + + + diff --git a/src/main/java/com/ecommerce/connection/DbConnection.java b/src/main/java/com/ecommerce/connection/DbConnection.java new file mode 100644 index 0000000..a97e5e7 --- /dev/null +++ b/src/main/java/com/ecommerce/connection/DbConnection.java @@ -0,0 +1,75 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package com.ecommerce.connection; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class DbConnection { + + + public static Connection connection; + + public static Connection getConnection(){ + + try{ + + Class.forName("com.mysql.jdbc.Driver"); + connection = DriverManager.getConnection("jdbc:mysql://localhost:3368/ecommerce", "root","root"); + + }catch(Exception e){ + e.printStackTrace(); + + } + return (connection); + } + + public static void CloseConnection(){ + if(connection !=null){ + try{ + connection.close(); + connection =null; + }catch(SQLException ex){ + ex.printStackTrace(); + } + } + } + + public static ResultSet getResultFromSqlQuery(String SqlQueryString){ + + ResultSet rs = null; + try{ + if (connection == null){ + getConnection(); + } + + rs = connection.createStatement().executeQuery(SqlQueryString); + + }catch(Exception ex){ + ex.printStackTrace(); + + } + return rs; + } + + public static int insertUpdateFromSqlQuery(String SqlQueryString){ + int i = 2; + try{ + if(connection ==null){ + getConnection(); + } + + i = connection.createStatement().executeUpdate(SqlQueryString); + }catch(Exception ex){ + ex.printStackTrace(); + + } + return i; + + + } +} diff --git a/src/main/java/com/ecommerce/registration/RegistrationServlet.java b/src/main/java/com/ecommerce/registration/RegistrationServlet.java new file mode 100644 index 0000000..f19c62d --- /dev/null +++ b/src/main/java/com/ecommerce/registration/RegistrationServlet.java @@ -0,0 +1,97 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template + */ +package com.ecommerce.registration; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.io.IOException; +import java.io.PrintWriter; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +/** + * + * @author oladimeji + */ +@WebServlet(name = "RegistrationServlet", urlPatterns = {"/register"}) +public class RegistrationServlet extends HttpServlet { + + + + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + String yname = request.getParameter("name"); + String yemail = request.getParameter("email"); + String uname = request.getParameter("username"); + String addy = request.getParameter("address"); + String pass = request.getParameter("passwordd"); + RequestDispatcher dispatcher = null; + + Connection con = null; + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + con = DriverManager.getConnection("jdbc:mysql://localhost:3306/ecommerce","root","rootroot" ); + PreparedStatement pst = con.prepareStatement("insert into register(name,email,username,address,password) values(?,?,?,?,?) "); + + pst.setString(1, yname); + pst.setString(2, yemail); + pst.setString(3, uname); + pst.setString(4, addy); + pst.setString(5, pass); + + int rowCount = pst.executeUpdate(); + dispatcher = request.getRequestDispatcher("register.jsp"); + if (rowCount > 0){ + request.setAttribute("status", "sucess"); + response.sendRedirect("login.jsp"); + + } else{ + request.setAttribute("status","failed"); + } + + dispatcher.forward(request, response); + } catch (Exception e){ + e.printStackTrace(); + + } + /*finally{ + try{ + con.close(); + }catch(SQLException e){ + e.printStackTrace(); + } + }*/ + + + + + + + + + + + + + + } + + + + + + +} diff --git a/src/main/webapp/META-INF/context.xml b/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..d90830f --- /dev/null +++ b/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..7ea23da --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,30 @@ +<%-- + Document : index + Created on : 13 Aug 2022, 23:19:17 + Author : oladimeji +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + +
+ +
+ + + + + diff --git a/src/main/webapp/login.jsp b/src/main/webapp/login.jsp new file mode 100644 index 0000000..4f9ef57 --- /dev/null +++ b/src/main/webapp/login.jsp @@ -0,0 +1,50 @@ +<%-- + Document : login + Created on : 14 Aug 2022, 01:47:18 + Author : oladimeji +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + +
+

Login

+
+ +
+ + + + + + + + + +

+ New to Computer For You? Create Account +

+
+ + diff --git a/src/main/webapp/register.jsp b/src/main/webapp/register.jsp new file mode 100644 index 0000000..5f53f7b --- /dev/null +++ b/src/main/webapp/register.jsp @@ -0,0 +1,67 @@ +<%-- + Document : register + Created on : 14 Aug 2022, 01:47:41 + Author : oladimeji +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + +

Sign-up

+ +
+ + + + + + + + + + + + + + <-- + + +

+ Already have an account? Login! +

+
+ + diff --git a/src/main/webapp/style.css b/src/main/webapp/style.css new file mode 100644 index 0000000..5efa258 --- /dev/null +++ b/src/main/webapp/style.css @@ -0,0 +1,80 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template +*/ +/* + Created on : 14 Aug 2022, 01:04:51 + Author : oladimeji +*/ + +/* + Nav Bar +*/ +ul { + display: flex; + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + background-color: gray; + justify-content: space-between; +} + +li { + float: left; +} + +li a { + display: block; + color: white; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} + +li a:hover { + background-color: #111; +} + + +/* Registration */ + +h2 { + text-align: center; +} + + +form, .content { + width: 30%; + margin: 0px auto; + padding: 20px; + border: 1px solid #B0C4DE; + background: white; + border-radius: 0px 0px 10px 10px; + font-size:16px; +} + +.signup-group { + margin: 10px 0px 10px 0px; +} +.signup-group label { + display: block; + text-align: left; + margin: 3px; +} +.signup-group input { + height: 30px; + width: 93%; + padding: 5px 10px; + border-radius: 5px; + border: 1px solid gray; + font-size:14px; +} +.signup-btn { + padding: 10px; + font-size: 15px; + color: white; + background:black; + border: none; + border-radius: 5px; +} \ No newline at end of file diff --git a/target/classes/.netbeans_automatic_build b/target/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/target/classes/com/ecommerce/connection/DbConnection.class b/target/classes/com/ecommerce/connection/DbConnection.class new file mode 100644 index 0000000..4521bbc Binary files /dev/null and b/target/classes/com/ecommerce/connection/DbConnection.class differ diff --git a/target/classes/com/ecommerce/registration/RegistrationServlet.class b/target/classes/com/ecommerce/registration/RegistrationServlet.class new file mode 100644 index 0000000..72aaf34 Binary files /dev/null and b/target/classes/com/ecommerce/registration/RegistrationServlet.class differ diff --git a/target/endorsed/javaee-endorsed-api-7.0.jar b/target/endorsed/javaee-endorsed-api-7.0.jar new file mode 100644 index 0000000..7f2e96d Binary files /dev/null and b/target/endorsed/javaee-endorsed-api-7.0.jar differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..824f91e --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=mavenproject3 +groupId=com.mycompany +version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..aeeedbc --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +com/ecommerce/registration/RegistrationServlet.class +com/ecommerce/connection/DbConnection.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..21d2941 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,2 @@ +/Users/oladimeji/NetBeansProjects/mavenproject3/src/main/java/com/ecommerce/connection/DbConnection.java +/Users/oladimeji/NetBeansProjects/mavenproject3/src/main/java/com/ecommerce/registration/RegistrationServlet.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/target/mavenproject3-1.0-SNAPSHOT.war b/target/mavenproject3-1.0-SNAPSHOT.war new file mode 100644 index 0000000..ac759d9 Binary files /dev/null and b/target/mavenproject3-1.0-SNAPSHOT.war differ diff --git a/target/mavenproject3-1.0-SNAPSHOT/META-INF/context.xml b/target/mavenproject3-1.0-SNAPSHOT/META-INF/context.xml new file mode 100644 index 0000000..d90830f --- /dev/null +++ b/target/mavenproject3-1.0-SNAPSHOT/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/target/mavenproject3-1.0-SNAPSHOT/Tomcat.dpf b/target/mavenproject3-1.0-SNAPSHOT/Tomcat.dpf new file mode 100644 index 0000000..d90830f --- /dev/null +++ b/target/mavenproject3-1.0-SNAPSHOT/Tomcat.dpf @@ -0,0 +1,2 @@ + + diff --git a/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/.netbeans_automatic_build b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/com/ecommerce/connection/DbConnection.class b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/com/ecommerce/connection/DbConnection.class new file mode 100644 index 0000000..4521bbc Binary files /dev/null and b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/com/ecommerce/connection/DbConnection.class differ diff --git a/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/com/ecommerce/registration/RegistrationServlet.class b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/com/ecommerce/registration/RegistrationServlet.class new file mode 100644 index 0000000..72aaf34 Binary files /dev/null and b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/classes/com/ecommerce/registration/RegistrationServlet.class differ diff --git a/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-8.0.30.jar b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-8.0.30.jar new file mode 100644 index 0000000..92ebe1b Binary files /dev/null and b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/lib/mysql-connector-java-8.0.30.jar differ diff --git a/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.19.4.jar b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.19.4.jar new file mode 100644 index 0000000..a545ea0 Binary files /dev/null and b/target/mavenproject3-1.0-SNAPSHOT/WEB-INF/lib/protobuf-java-3.19.4.jar differ diff --git a/target/mavenproject3-1.0-SNAPSHOT/index.jsp b/target/mavenproject3-1.0-SNAPSHOT/index.jsp new file mode 100644 index 0000000..7ea23da --- /dev/null +++ b/target/mavenproject3-1.0-SNAPSHOT/index.jsp @@ -0,0 +1,30 @@ +<%-- + Document : index + Created on : 13 Aug 2022, 23:19:17 + Author : oladimeji +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + +
+ +
+ + + + + diff --git a/target/mavenproject3-1.0-SNAPSHOT/login.jsp b/target/mavenproject3-1.0-SNAPSHOT/login.jsp new file mode 100644 index 0000000..4f9ef57 --- /dev/null +++ b/target/mavenproject3-1.0-SNAPSHOT/login.jsp @@ -0,0 +1,50 @@ +<%-- + Document : login + Created on : 14 Aug 2022, 01:47:18 + Author : oladimeji +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + + + +
+ + + + + + + + + +

+ New to Computer For You? Create Account +

+
+ + diff --git a/target/mavenproject3-1.0-SNAPSHOT/register.jsp b/target/mavenproject3-1.0-SNAPSHOT/register.jsp new file mode 100644 index 0000000..5f53f7b --- /dev/null +++ b/target/mavenproject3-1.0-SNAPSHOT/register.jsp @@ -0,0 +1,67 @@ +<%-- + Document : register + Created on : 14 Aug 2022, 01:47:41 + Author : oladimeji +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + + + + +

Sign-up

+ +
+ + + + + + + + + + + + + + <-- + + +

+ Already have an account? Login! +

+
+ + diff --git a/target/mavenproject3-1.0-SNAPSHOT/style.css b/target/mavenproject3-1.0-SNAPSHOT/style.css new file mode 100644 index 0000000..5efa258 --- /dev/null +++ b/target/mavenproject3-1.0-SNAPSHOT/style.css @@ -0,0 +1,80 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template +*/ +/* + Created on : 14 Aug 2022, 01:04:51 + Author : oladimeji +*/ + +/* + Nav Bar +*/ +ul { + display: flex; + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + background-color: gray; + justify-content: space-between; +} + +li { + float: left; +} + +li a { + display: block; + color: white; + text-align: center; + padding: 14px 16px; + text-decoration: none; +} + +li a:hover { + background-color: #111; +} + + +/* Registration */ + +h2 { + text-align: center; +} + + +form, .content { + width: 30%; + margin: 0px auto; + padding: 20px; + border: 1px solid #B0C4DE; + background: white; + border-radius: 0px 0px 10px 10px; + font-size:16px; +} + +.signup-group { + margin: 10px 0px 10px 0px; +} +.signup-group label { + display: block; + text-align: left; + margin: 3px; +} +.signup-group input { + height: 30px; + width: 93%; + padding: 5px 10px; + border-radius: 5px; + border: 1px solid gray; + font-size:14px; +} +.signup-btn { + padding: 10px; + font-size: 15px; + color: white; + background:black; + border: none; + border-radius: 5px; +} \ No newline at end of file diff --git a/target/test-classes/.netbeans_automatic_build b/target/test-classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29