createAdsFromResults(ResultSet rs) throws SQLException {
}
return ads;
}
+
+
+
}
diff --git a/src/main/java/com/codeup/adlister/dao/MySQLUsersDao.java b/src/main/java/com/codeup/adlister/dao/MySQLUsersDao.java
index 4e69e57044..73adcdd4c3 100644
--- a/src/main/java/com/codeup/adlister/dao/MySQLUsersDao.java
+++ b/src/main/java/com/codeup/adlister/dao/MySQLUsersDao.java
@@ -51,6 +51,43 @@ public Long insert(User user) {
}
}
+ @Override
+ public void updateUser(Long id, String username, String email, String password) {
+ // Storing update query in string.
+ String updateUserQuery = "UPDATE users SET username = ?, email = ?, password = ? WHERE id = ?";
+ try {
+ PreparedStatement statement = connection.prepareStatement(updateUserQuery);
+
+ // Setting values of "?" in update user query.
+ statement.setString(1, username);
+ statement.setString(2, email);
+ statement.setString(3, password);
+ statement.setLong(4, id);
+
+ // Execute update query.
+ statement.executeUpdate();
+
+ } catch (SQLException e) {
+ throw new RuntimeException("Error updating user information.");
+ }
+ }
+
+ @Override
+ public void deleteUser(Long id) {
+ String deleteUserQuery = "DELETE FROM users WHERE id = ?";
+ try {
+ PreparedStatement statement = connection.prepareStatement(deleteUserQuery);
+
+ // Setting value of question mark in SQL query to the id that's being passed in as parameter.
+ statement.setLong(1, id);
+
+ // Executing delete user query.
+ statement.executeUpdate();
+ } catch (SQLException e) {
+ throw new RuntimeException("Error deleting user.");
+ }
+ }
+
private User extractUser(ResultSet rs) throws SQLException {
if (! rs.next()) {
return null;
diff --git a/src/main/java/com/codeup/adlister/dao/Users.java b/src/main/java/com/codeup/adlister/dao/Users.java
index 62da74d20b..f90bf864c9 100644
--- a/src/main/java/com/codeup/adlister/dao/Users.java
+++ b/src/main/java/com/codeup/adlister/dao/Users.java
@@ -7,4 +7,6 @@
public interface Users {
User findByUsername(String username);
Long insert(User user);
+ void updateUser(Long id, String username, String email, String password);
+ void deleteUser(Long id);
}
diff --git a/src/main/webapp/WEB-INF/ad.jsp b/src/main/webapp/WEB-INF/ad.jsp
new file mode 100644
index 0000000000..cbecfd94ae
--- /dev/null
+++ b/src/main/webapp/WEB-INF/ad.jsp
@@ -0,0 +1,23 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: casanovageary
+ Date: 11/14/22
+ Time: 3:32 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ ad
+
+
+
+
+
+
${singleAd.title}
+
${singleAd.description}
+
+
+
diff --git a/src/main/webapp/WEB-INF/ads/create.jsp b/src/main/webapp/WEB-INF/ads/create.jsp
index f6332692f7..28e28dfd79 100644
--- a/src/main/webapp/WEB-INF/ads/create.jsp
+++ b/src/main/webapp/WEB-INF/ads/create.jsp
@@ -1,22 +1,30 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+ create ad
+
-
Create a new Ad
+
create a new ad
diff --git a/src/main/webapp/WEB-INF/ads/index.jsp b/src/main/webapp/WEB-INF/ads/index.jsp
index 6f4371f0bb..f9ccd6d046 100644
--- a/src/main/webapp/WEB-INF/ads/index.jsp
+++ b/src/main/webapp/WEB-INF/ads/index.jsp
@@ -5,20 +5,20 @@
+ ad
-
+
-
diff --git a/src/main/webapp/WEB-INF/ads/result.jsp b/src/main/webapp/WEB-INF/ads/result.jsp
new file mode 100644
index 0000000000..f5002228e6
--- /dev/null
+++ b/src/main/webapp/WEB-INF/ads/result.jsp
@@ -0,0 +1,24 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+
+
+
+ ad
+
+
+
+
+
+
Here is the ad you are looking for!
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/ads/update.jsp b/src/main/webapp/WEB-INF/ads/update.jsp
new file mode 100644
index 0000000000..c4c3ad32bd
--- /dev/null
+++ b/src/main/webapp/WEB-INF/ads/update.jsp
@@ -0,0 +1,33 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: vicente
+ Date: 11/14/22
+ Time: 11:09 AM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/delete-profile.jsp b/src/main/webapp/WEB-INF/delete-profile.jsp
new file mode 100644
index 0000000000..20385bd429
--- /dev/null
+++ b/src/main/webapp/WEB-INF/delete-profile.jsp
@@ -0,0 +1,23 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: localdev
+ Date: 11/16/22
+ Time: 9:52 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+
+
+
+
+
+
+ Delete Your Profile
+
+
+
diff --git a/src/main/webapp/WEB-INF/login.jsp b/src/main/webapp/WEB-INF/login.jsp
index 83ce2d0a1f..72a1725539 100644
--- a/src/main/webapp/WEB-INF/login.jsp
+++ b/src/main/webapp/WEB-INF/login.jsp
@@ -1,23 +1,30 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+ login
diff --git a/src/main/webapp/WEB-INF/partials/navbar-ads-index.jsp b/src/main/webapp/WEB-INF/partials/navbar-ads-index.jsp
new file mode 100644
index 0000000000..c5e762687a
--- /dev/null
+++ b/src/main/webapp/WEB-INF/partials/navbar-ads-index.jsp
@@ -0,0 +1,31 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%--
+ Created by IntelliJ IDEA.
+ User: casanovageary
+ Date: 11/14/22
+ Time: 3:08 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
diff --git a/src/main/webapp/WEB-INF/partials/navbar-create-ad.jsp b/src/main/webapp/WEB-INF/partials/navbar-create-ad.jsp
new file mode 100644
index 0000000000..2c5a2c772f
--- /dev/null
+++ b/src/main/webapp/WEB-INF/partials/navbar-create-ad.jsp
@@ -0,0 +1,29 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: casanovageary
+ Date: 11/14/22
+ Time: 2:24 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/partials/navbar-logged-in.jsp b/src/main/webapp/WEB-INF/partials/navbar-logged-in.jsp
new file mode 100644
index 0000000000..ea52aa875a
--- /dev/null
+++ b/src/main/webapp/WEB-INF/partials/navbar-logged-in.jsp
@@ -0,0 +1,29 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: casanovageary
+ Date: 11/14/22
+ Time: 10:45 AM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
diff --git a/src/main/webapp/WEB-INF/partials/navbar-register.jsp b/src/main/webapp/WEB-INF/partials/navbar-register.jsp
new file mode 100644
index 0000000000..40e06548b0
--- /dev/null
+++ b/src/main/webapp/WEB-INF/partials/navbar-register.jsp
@@ -0,0 +1,20 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: casanovageary
+ Date: 11/14/22
+ Time: 2:43 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
diff --git a/src/main/webapp/WEB-INF/partials/navbar.jsp b/src/main/webapp/WEB-INF/partials/navbar.jsp
index 8e1f98f662..0389a37bf5 100644
--- a/src/main/webapp/WEB-INF/partials/navbar.jsp
+++ b/src/main/webapp/WEB-INF/partials/navbar.jsp
@@ -1,3 +1,5 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
diff --git a/src/main/webapp/WEB-INF/profile.jsp b/src/main/webapp/WEB-INF/profile.jsp
index 05e3fa7a91..8815bab48d 100644
--- a/src/main/webapp/WEB-INF/profile.jsp
+++ b/src/main/webapp/WEB-INF/profile.jsp
@@ -1,15 +1,44 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+ my profile
-
+
Welcome, ${sessionScope.user.username}!
+
+
+
+
+
+
+
${sessionScope.ads}
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/register.jsp b/src/main/webapp/WEB-INF/register.jsp
index 4b64e10a43..2cf41bf079 100644
--- a/src/main/webapp/WEB-INF/register.jsp
+++ b/src/main/webapp/WEB-INF/register.jsp
@@ -1,12 +1,14 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+ registration
-
+
Please fill in your information.
+
@@ -26,6 +29,9 @@
+
+ No fields left blank.
+
diff --git a/src/main/webapp/WEB-INF/update-profile.jsp b/src/main/webapp/WEB-INF/update-profile.jsp
new file mode 100644
index 0000000000..a441df146d
--- /dev/null
+++ b/src/main/webapp/WEB-INF/update-profile.jsp
@@ -0,0 +1,39 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%--
+ Created by IntelliJ IDEA.
+ User: vicente
+ Date: 11/16/22
+ Time: 2:09 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+
+
+
+ Title
+
+
+ Edit Your Profile
+
+
+
diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp
index 68cf346ec9..b47ff042c9 100644
--- a/src/main/webapp/index.jsp
+++ b/src/main/webapp/index.jsp
@@ -1,15 +1,18 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+ welcome to adlister
-
Welcome to the Adlister!
+
welcome to adlister!
+
">