Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.iml
target/
.idea/
39 changes: 39 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.codeup.adlister</groupId>
<artifactId>adlister</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>

</project>
15 changes: 15 additions & 0 deletions src/main/java/CounterServlet.java
Original file line number Diff line number Diff line change
@@ -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("<h1>The count is " + counter + ".</h1>");
}
}
12 changes: 12 additions & 0 deletions src/main/java/HelloWorldServlet.java
Original file line number Diff line number Diff line change
@@ -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("<h1>Hello, World!</h1>");
}
}
25 changes: 25 additions & 0 deletions src/main/webapp/counter.jsp
Original file line number Diff line number Diff line change
@@ -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");
%>

<html>
<head>
<title>Title</title>
</head>
<body>

<h1>The current count is <%= counter %>.</h1>

<p> Your number is <%= two %></p>

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

View the page source!

<%-- this is a JSP comment, you will *not* see this in the html --%>

<!-- this is an HTML comment, you *will* see this in the html -->

</body>
</html>
15 changes: 15 additions & 0 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title><%= "some title" %></title>
</head>
<body>
<c:if test="true">
<h1>Variable names should be very descriptive</h1>
</c:if>
<c:if test="false">
<h1>single letter variable names are good</h1>
</c:if>
</body>
</html>
38 changes: 38 additions & 0 deletions src/main/webapp/login.jsp
Original file line number Diff line number Diff line change
@@ -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" %>
<html>
<head>
<title>Title</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">

</head>
<body>
<form action="http://localhost:8080/profile.jsp" method="POST">
<div class="form-group">
<label for="exampleInputUsername">Username</label>
<input type="user" class="form-control" id="exampleInputUsername" aria-describedby="userHelp">
<small id="userHelp" class="form-text text-muted">We'll never share your username with anyone else.</small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1">
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Remember Me</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions src/main/webapp/navbar.jsp
Original file line number Diff line number Diff line change
@@ -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" %>
<html>
<head>
<title>Title</title>
</head>
<body>

</body>
</html>
17 changes: 17 additions & 0 deletions src/main/webapp/profile.jsp
Original file line number Diff line number Diff line change
@@ -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" %>
<html>
<head>
<h1>Profile Page</h1>
</head>
<body>


</body>
</html>