📄 flightlist.jsp
字号:
<%@page language="java" session="true" import="fr.ier.cuss.globaldemo.*, java.text.SimpleDateFormat, java.util.*" %>
<%@ include file = "include/util.jsp" %>
<%
Passenger passenger = (Passenger)session.getAttribute("Passenger");
TimeCalculator timeCalculator = (TimeCalculator)session.getAttribute("TimeCalculator");
Travel travel = timeCalculator.getFlightList(passenger);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
%>
<html>
<head>
<%@ include file = "include/header.jsp" %>
<script language="JavaScript1.2">
//------------------------------------------------------------------------
/*
* Event management
*/
function processEventBis(event) {
// Nothing to do
}
//------------------------------------------------------------------------
/**
* Select a row in the table
*/
function selectRow(index) {
var background = "red";
var color = "black";
eval("row" + index + ".style.background = background;");
eval("col" + index + "1.style.color = color;");
eval("col" + index + "1.style.background = background;");
eval("col" + index + "2.style.color = color;");
eval("col" + index + "2.style.background = background;");
eval("col" + index + "3.style.color = color;");
eval("col" + index + "3.style.background = background;");
eval("col" + index + "4.style.color = color;");
eval("col" + index + "4.style.background = background;");
eval("col" + index + "5.style.color = color;");
eval("col" + index + "5.style.background = background;");
}
//------------------------------------------------------------------------
/**
* Unselect a row in the table
*/
function unselectRow(index) {
var background = "blue";
var color = "white";
eval("row" + index + ".style.background = background;");
eval("col" + index + "1.style.color = color;");
eval("col" + index + "1.style.background = background;");
eval("col" + index + "2.style.color = color;");
eval("col" + index + "2.style.background = background;");
eval("col" + index + "3.style.color = color;");
eval("col" + index + "3.style.background = background;");
eval("col" + index + "4.style.color = color;");
eval("col" + index + "4.style.background = background;");
eval("col" + index + "5.style.color = color;");
eval("col" + index + "5.style.background = background;");
}
//------------------------------------------------------------------------
/**
* DisplayCheckinPage
*/
function displayCheckinPage(flightCarrier, flightNumber, departure, arrival) {
displayPage("checkin.jsp?flightCarrier=" + flightCarrier + "&flightNumber=" + flightNumber + "&departure=" + departure + "&arrival=" + arrival);
}
</script>
</head>
<body unselectable="on" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="javascript:init();" background="<%= backgroundImageName%>" >
<table border="0" width="100%" height="100%">
<thead>
<%@ include file = "include/companylogo.jsp" %>
</thead>
<!-- =============================================================== -->
<!-- Body of the table for message -->
<!-- =============================================================== -->
<tbody>
<tr>
<td colspan="4" valign="top" height="70%" width="100%">
<h1 class="subTitle" align="center">Please select your flight</p>
<table cellspacing="1" width="100%" >
<tr class="tableHeader">
<th align="center" height="50" width="20%">Departure</th>
<th align="center" width="20%">Arrival</th>
<th align="center" width="20%">From</th>
<th align="center" width="20%">To</th>
<th align="center" width="20%">Flight</th>
</tr>
<%
for (int i = 0 ; i < travel.getFlightNumber(); i++) {
Flight flight = travel.getFlight(i);
String flightCarrier = flight.getFlightCarrier();
String flightNumber = flight.getFlightNumber();
String departure = simpleDateFormat.format(flight.getDepartureDate().getTime());
String arrival = simpleDateFormat.format(flight.getArrivalDate().getTime());
%>
<tr id="row<%= i%>">
<td id="col<%= i%>1" class="tableData" align="center" Onclick="javascript:displayCheckinPage('<%= flightCarrier%>', '<%= flightNumber%>', '<%= departure%>', '<%= arrival%>')" OnMouseOver="javascript:selectRow('<%= i%>')" OnMouseOut="javascript:unselectRow('<%= i%>')" height="50"><%= departure%></td>
<td id="col<%= i%>2" align="center" class="tableData" Onclick="javascript:displayCheckinPage('<%= flightCarrier%>', '<%= flightNumber%>', '<%= departure%>', '<%= arrival%>')" OnMouseOver="javascript:selectRow('<%= i%>')" OnMouseOut="javascript:unselectRow('<%= i%>')"><%= arrival %></td>
<td id="col<%= i%>3" align="center" class="tableData" Onclick="javascript:displayCheckinPage('<%= flightCarrier%>', '<%= flightNumber%>', '<%= departure%>', '<%= arrival%>')" OnMouseOver="javascript:selectRow('<%= i%>')" OnMouseOut="javascript:unselectRow('<%= i%>')"><%= passenger.getTravel().getFlight(0).getDepartureAirport().getCity() %></td>
<td id="col<%= i%>4" align="center" class="tableData" Onclick="javascript:displayCheckinPage('<%= flightCarrier%>', '<%= flightNumber%>', '<%= departure%>', '<%= arrival%>')" OnMouseOver="javascript:selectRow('<%= i%>')" OnMouseOut="javascript:unselectRow('<%= i%>')"><%= passenger.getTravel().getFlight(0).getArrivalAirport().getCity() %></td>
<td id="col<%= i%>5" align="center" class="tableData" Onclick="javascript:displayCheckinPage('<%= flightCarrier%>', '<%= flightNumber%>', '<%= departure%>', '<%= arrival%>')" OnMouseOver="javascript:selectRow('<%= i%>')" OnMouseOut="javascript:unselectRow('<%= i%>')"><%= flightCarrier + " " + flightNumber %></td>
</tr>
<%
}
%>
</table>
</td>
</tr>
</tbody>
<!-- =============================================================== -->
<!-- Foot of the table for buttons -->
<!-- =============================================================== -->
<tfoot>
<tr>
<td height="15%" width="25%" align="center"> </td>
<td width="25%" align="center"> </td>
<td width="25%" align="center"> </td>
<td width="25%" align="center"><%@ include file = "include/quitbutton.jsp" %></td>
</tr>
</tfoot>
</table>
</body>
</html>
<%!
private String formatFlightNumber(int flightNumber){
String result = "" + flightNumber;
while (result.length() < 3) {
result = "0" + result;
}
return result;
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -