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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
*.iml
node_modules
node_modules
/target/
3 changes: 3 additions & 0 deletions WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

Binary file added WebContent/WEB-INF/lib/aopalliance-1.0.jar
Binary file not shown.
Binary file added WebContent/WEB-INF/lib/commons-logging-1.1.3.jar
Binary file not shown.
Binary file added WebContent/WEB-INF/lib/json-simple-1.1.1.jar
Binary file not shown.
Binary file added WebContent/WEB-INF/lib/jstl-1.2.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions WebContent/WEB-INF/spring/webcontext/DispatcherServlet-context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">

<mvc:annotation-driven />
<context:component-scan base-package="com.flight.simpleFlightSearch" />

<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
37 changes: 37 additions & 0 deletions WebContent/WEB-INF/views/flight.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<link rel="stylesheet"
href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<title>Welcome</title>

<script>
info = ${info};
if (info != null) {
document.getElementById('image-description').style.display = 'block';
} else {
document.getElementById('image-description').style.display = 'none';
}
</script>
</head>
<body>
<section>
<div class="jumbotron">
<div class="container">
<h1>${greeting}</h1>
<p>${tagline}</p>
</div>
</div>
</section>

<h1>Flight Information for the request</h1>
<div class="jumbotron">
<div id ="image-description" class="container">
<p>${info}</p>
</div>
</div>

</body>
</html>
18 changes: 18 additions & 0 deletions WebContent/WEB-INF/views/search.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
</head>
<body>
<table align="center">
<tr>
<td><a href="login">Login</a>
</td>
<td><a href="register">Register</a>
</td>
</tr>
</table>
</body>
</html>
50 changes: 50 additions & 0 deletions WebContent/WEB-INF/views/welcome.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<link rel="stylesheet"
href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<title>Welcome</title>
</head>
<body>
<section>
<div class="jumbotron">
<div class="container">
<h1>${greeting}</h1>
<p>${tagline}</p>
</div>
</div>
</section>
<form action="/simpleFlightSearch/search" method="get">
<div class="container">
<label for="flightNum"><b>FlightNumber</b></label>
<input type="text" placeholder="Enter Username" name="flightNum" required>

<label for="orgn"><b>Origin</b></label>
<input type="text" placeholder="Enter Origin" name="orn" required>

<label for="dest"><b>Destination</b></label>
<input type="text" placeholder="Enter Destination" name="dest" required>

<label for="date"><b>Date</b></label>
<input type="date" placeholder="Enter Date" name="date" required>


<button type="submit">Search</button>
<!-- <label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label> -->
</div>
</form>

<h1>Flight Information for the request</h1>
<div class="jumbotron">
<div id ="image-description" class="container">
<p>${info}</p>
</div>
</div>
</ul>

</body>
</html>
21 changes: 21 additions & 0 deletions WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/webcontext/DispatcherServlet-context.xml
</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

</web-app>
148 changes: 148 additions & 0 deletions flight-sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
[
{
"flightNumber": "2005",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T05:10:00",
"destination": "ORD",
"arrival": "2018-01-31T07:57:00",
"aircraft": "Airbus A320",
"distance": 925,
"travelTime": "02:47",
"status": "Arrived at Gate"

},
{
"flightNumber": "0638",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T07:45:00",
"destination": "ORD",
"arrival": "2018-01-31T10:18:00",
"aircraft": "Boeing 737-900",
"distance": 925,
"travelTime": "02:33",
"status": "Arrived at Gate"
},
{
"flightNumber": "1160",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T12:05:00",
"destination": "ORD",
"arrival": "2018-01-31T14:38:00",
"aircraft": "Boeing 737-800",
"distance": 925,
"travelTime": "02:41",
"status": "Arrived at Gate"
},
{
"flightNumber": "1256",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T14:22:00",
"destination": "ORD",
"arrival": "2018-01-31T17:01:00",
"aircraft": "Boeing 737-800",
"distance": 925,
"travelTime": "02:41",
"status": "On Time"
},
{
"flightNumber": "2153",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T16:24:00",
"destination": "ORD",
"arrival": "2018-01-31T19:27:00",
"aircraft": "Boeing 737-800",
"distance": 925,
"travelTime": "02:47",
"status": "On Time"
},
{
"flightNumber": "2155",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T18:10:00",
"destination": "ORD",
"arrival": "2018-01-31T20:49:00",
"aircraft": "Boeing 737-900",
"distance": 925,
"travelTime": "02:39",
"status": "On Time"
},
{
"flightNumber": "2131",
"carrier": "UA",
"origin": "IAH",
"departure": "2018-01-31T19:49:00",
"destination": "ORD",
"arrival": "2018-01-31T22:00:00",
"aircraft": "Boeing 737-900",
"distance": 925,
"travelTime": "02:31",
"status": "On Time"
},
{
"flightNumber": "2043",
"carrier": "UA",
"origin": "ORD",
"departure": "2018-01-31T06:08:00",
"destination": "IAH",
"arrival": "2018-01-31T08:42:00",
"aircraft": "Boeing 737-800",
"distance": 925,
"travelTime": "02:34",
"status": "Arrived at Gate"
},
{
"flightNumber": "0748",
"carrier": "UA",
"origin": "ORD",
"departure": "2018-01-31T08:10:00",
"destination": "IAH",
"arrival": "2018-01-31T10:44:00",
"aircraft": "Boeing 737-900",
"distance": 925,
"travelTime": "02:34",
"status": "Arrived at Gate"
},
{
"flightNumber": "2166",
"carrier": "UA",
"origin": "ORD",
"departure": "2018-01-31T10:15:00",
"destination": "IAH",
"arrival": "2018-01-31T12:53:00",
"aircraft": "Airbus A320",
"distance": 925,
"travelTime": "02:34",
"status": "Arrived at Gate"
},
{
"flightNumber": "2171",
"carrier": "UA",
"origin": "ORD",
"departure": "2018-01-31T12:45:00",
"destination": "IAH",
"arrival": "2018-01-31T15:34:00",
"aircraft": "Airbus A320",
"distance": 925,
"travelTime": "02:39",
"status": "On Time"
},
{
"flightNumber": "1128",
"carrier": "UA",
"origin": "ORD",
"departure": "2018-01-31T14:05:00",
"destination": "IAH",
"arrival": "2018-01-31T16:52:00",
"aircraft": "Boeing 737-800",
"distance": 925,
"travelTime": "02:41",
"status": "On Time"
}

]
72 changes: 72 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<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.flight</groupId>
<artifactId>simpleFlightSearch</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SearchFlights</name>
<packaging>war</packaging>
<!-- Add Spring Web and MVC dependencies -->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.12</version>
</dependency>

<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName> <!-- added to remove Version from WAR file -->
</build>
</project>
Loading