<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!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>Flights Search Page</title>
</head>
<body>
<h1>Flights Search Page</h1>
</br>
<!-- (post)using a form -->
<form method="post"
action="${pageContext.request.contextPath }/flightcontroller">
Flight Numeber <input type="text" name="fn" value="Flight Numeber"><br/>
Flight Departure Date <input type="text" name="fdd" value="Flight Departure Date"><br/>
Flight Departure City <input type="text" name="fdc" value="Flight Departure City"><br/>
<input type="submit" value="Search Flights">
</form>
<br/>
<!-- only display the table after user click the submit button(request) -->
<!-- check whether flist is null -->
<c:if test="${requestScope.flist ne null}">
<table border="1">
<tr>
<th>Flight Id</th>
<th>Departure</th>
<th>Departure Date</th>
<th>Arrival</th>
<th>Arrival Date</th>
</tr>
<c:forEach var="flight" items="${requestScope.flist}"
varStatus="Status">
<tr>
<td>${flight.idFlight}</td>
<td>${flight.depatureCity}</td>
<td>${flight.depature}</td>
<td>${flight.arrivalcity}</td>
<td>${flight.arrival}</td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
<%-- <!-- (get)using uri -->
Flight Numeber <input type="text" name="fn" value="Flight Numeber"></br>
Flight Departure Date <input type="text" name="fdd" value="Flight Departure Date"></br>
Flight Departure City <input type="text" name="fdc" value="Flight Departure City"></br>
<a href="${pageContext.request.contextPath }/flightcontroller?fn>=${fn}&fdd=${fdd}&fdc=${fdc}">Search Flights</a>
//how to get param form input to apend to the url ?may be not in this way, but the concept is like this : fn>=${fn}&fdd=${fdd}&fdc=${fdc}
--%>
网友评论