Skip to content

Commit

Permalink
Error Page Exists Now
Browse files Browse the repository at this point in the history
  • Loading branch information
clj13001 committed Apr 12, 2017
1 parent 66dd230 commit 9efc228
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 7 deletions.
11 changes: 11 additions & 0 deletions WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Application Name </display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/html/webpages/error.jsp</location>
</error-page>
</web-app>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions WebContent/html/webpages/error.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel = "stylesheet" type = "text/css" href = "../css/stylesheet.css">
<link rel = "shortcut icon" href = "../imgs/synchrony-financial-logo-dlpx_1.ico">
<style>
div.error{
text-align: center;
position: absolute;
top: 50%;
left: 50%;
margin-top: -126px;
margin-left: -138px;
}
</style>
</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
</nav>
<div class = "error">
<h2>Error</h2>
<img src="../imgs/my-icons-collection-128px/png/warning.png"/>
<h2>Page Does Not Exist</h2>
</div>
</body>
</html>
13 changes: 6 additions & 7 deletions WebContent/html/webpages/navbar.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../webpages/admin.jsp">
<a class="navbar-brand" href="index.jsp">
<img src="../imgs/synchrony-financial-logo-dlpx_1.png" style = "height: 100%; display: inline-block;">
&nbsp;&nbsp;&nbsp;&nbsp;
<p style = "display: inline-block" id = "user"></p>
</a>
<a class="navbar-brand" href="profileSettings.jsp">
<p style = "display: inline-block" id = "user"></p>
</a>
</div>
<div id="navbar" class="navbar-collapse collapse" aria-expanded="false">
Expand All @@ -27,11 +28,10 @@
Cookie[] usercookies = request.getCookies();
String navsso = "invalid";
String navname = "error";
User self = new User();
Cookie newCookie;
//iterate cookies
System.out.println("Cookies:\n----------\n");
for(Cookie c : usercookies){
System.out.println(c.getName());
if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it
navsso = c.getValue();
c.setMaxAge(0);//delete current
Expand All @@ -41,11 +41,10 @@
break;
}
}
System.out.println("\nnavsso = "+navsso+"\n");
if(navsso.equals("invalid"))//if we didn't get a cookie, redirect to the homepage to log in again!
response.sendRedirect("../../index.jsp");
else{
User self = EmployeeQueries.getEmployeeByID(Integer.parseInt(navsso));
self = EmployeeQueries.getEmployeeByID(Integer.parseInt(navsso));
navname = self.getName();
}
%>
Expand Down
4 changes: 4 additions & 0 deletions src/entities/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public class User {
private String email;
private int icon;

public User(){
//empty
}

public User(int id, int location, String name, String phone, String email, int icon){
this.id = id;
this.location = location;
Expand Down

0 comments on commit 9efc228

Please sign in to comment.