<%@ page import="java.util.*" %>
<html>
<head>
<title>Enquiry Result</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<link href="/assg3.css" rel="stylesheet" type="text/css">
</head>

<body>
<h1 align="center" class="title">Enquiry Result</h1>
<%
	String[] result = (String[]) request.getAttribute("result");

	if(result != null) {
		out.println("<form name=form1 method=post action=/servlet/Controller?service=CornerService&target=/travelCorner.jsp>");
		out.println("<table width=100% border=1>");
		out.println("<tr><td><div align=center>Selection</td><td><div align=center>Flight ID</td><td>");
		out.println("<div align=center>Date of departure</td>");
		out.println("<td><div align=center>Departure city</td><td><div align=center>Arrival city</td>");
		out.println("<td><div align=center>Departure time</td><td><div align=center>Arrival time</td>");
		out.println("<td><div align=center>Flight duration time</td><td><div align=center>Price</td></tr>");

		for(int i=0; i<result.length; i++) {
			out.println("<tr><td><div align=center><input type=checkbox name=checkbox value='"+result[i]+"'></td>");
			out.println("<td><div align=center>"+result[i].substring(0,5)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(5,9)+"-");
			out.println(result[i].substring(9,11)+"-");
			out.println(result[i].substring(11,13)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(13,23)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(23,33)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(33,35)+":");
			out.println(result[i].substring(35,37)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(37,39)+":");
			out.println(result[i].substring(39,41)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(41,45)+"</td>");
			out.println("<td><div align=center>"+result[i].substring(45,50)+"</td>");
			out.println("</tr>");
		}

		out.println("</table>");
		out.println("<input type=hidden name=mode value=add>");			
		out.println("<p><div align=center><input type=submit name=Submit value=Submit>");
		out.println("<input type=reset name=Reset value=Reset></div></p>");
		out.println("</form>");
	} else {
		out.println("<p align= center class=subtitle>No result found</p>");
	}
%>
<p align="center" class="nav">| <a href="/enquiry.jsp">Enquiry page</a> 
  | <a href="/servlet/Controller?service=CornerService&target=/travelCorner.jsp&mode=none">Travel Plan Corner</a>
|</p>
</body>
</html>
