diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..a65bf3836e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.iml +target/ +.idea/ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..9364a52064 --- /dev/null +++ b/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + com.codeup.adlister + adlister + 1.0-SNAPSHOT + war + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.0 + + 1.8 + 1.8 + + + + + + + + javax.servlet + javax.servlet-api + 3.0.1 + + + jstl + jstl + 1.2 + + + + \ No newline at end of file diff --git a/src/main/java/CounterServlet.java b/src/main/java/CounterServlet.java new file mode 100644 index 0000000000..e09f62d6e2 --- /dev/null +++ b/src/main/java/CounterServlet.java @@ -0,0 +1,15 @@ +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@WebServlet(name = "CounterServlet", urlPatterns = "/counter") +public class CounterServlet extends HttpServlet { + private int counter = 0; + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + counter += 1; + response.getWriter().println("

The count is " + counter + ".

"); + } +} diff --git a/src/main/java/HelloWorldServlet.java b/src/main/java/HelloWorldServlet.java new file mode 100644 index 0000000000..c9f9fef714 --- /dev/null +++ b/src/main/java/HelloWorldServlet.java @@ -0,0 +1,12 @@ +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@WebServlet(name = "HelloWorldServlet", urlPatterns = "/") +public class HelloWorldServlet extends HttpServlet { + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.getWriter().println("

Hello, World!

"); + } +} diff --git a/src/main/webapp/counter.jsp b/src/main/webapp/counter.jsp new file mode 100644 index 0000000000..268e8acb51 --- /dev/null +++ b/src/main/webapp/counter.jsp @@ -0,0 +1,25 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%! int counter = 0; int two = 2; %> +<% counter += 1; System.out.println("This is in console"); +%> + + + + Title + + + +

The current count is <%= counter %>.

+ +

Your number is <%= two %>

+ +

The current date is <%= java.time.LocalDate.now() %>

+ +View the page source! + +<%-- this is a JSP comment, you will *not* see this in the html --%> + + + + + diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000000..2e125edaf6 --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,15 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + <%= "some title" %> + + + +

Variable names should be very descriptive

+
+ +

single letter variable names are good

+
+ + diff --git a/src/main/webapp/login.jsp b/src/main/webapp/login.jsp new file mode 100644 index 0000000000..257abbd0b3 --- /dev/null +++ b/src/main/webapp/login.jsp @@ -0,0 +1,38 @@ +<%-- + Created by IntelliJ IDEA. + User: johnalejandro + Date: 11/30/21 + Time: 12:08 PM + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + +
+
+ + + We'll never share your username with anyone else. +
+
+ + +
+
+ + +
+ +
+ + + + + diff --git a/src/main/webapp/navbar.jsp b/src/main/webapp/navbar.jsp new file mode 100644 index 0000000000..d73f99b049 --- /dev/null +++ b/src/main/webapp/navbar.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: johnalejandro + Date: 11/30/21 + Time: 10:20 AM + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + diff --git a/src/main/webapp/profile.jsp b/src/main/webapp/profile.jsp new file mode 100644 index 0000000000..e502dc7420 --- /dev/null +++ b/src/main/webapp/profile.jsp @@ -0,0 +1,17 @@ +<%-- + Created by IntelliJ IDEA. + User: johnalejandro + Date: 11/30/21 + Time: 12:08 PM + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + +

Profile Page

+ + + + + +