Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
370
Chapter 15 Integrating Servlets and JSP
Listing 15.5 TravelCustomer.java (continued)
public void setRentalCarData(RentalCarInfo[] rentalCarData) {
this.rentalCarData = rentalCarData;
}
public HotelInfo[] getHotelData() {
return(hotelData);
}
public void setHotelData(HotelInfo[] hotelData) {
this.hotelData = hotelData;
}
// This would be replaced by a database lookup
// in a real application.
public String getFlights() {
String flightOrigin =
replaceIfMissing(getOrigin(), "Nowhere");
String flightDestination =
replaceIfMissing(getDestination(), "Nowhere");
Date today = new Date();
DateFormat formatter =
DateFormat.getDateInstance(DateFormat.MEDIUM);
String dateString = formatter.format(today);
String flightStartDate =
replaceIfMissing(getStartDate(), dateString);
String flightEndDate =
replaceIfMissing(getEndDate(), dateString);
String [][] flights =
{ { "Java Airways", "1522", "455.95", "Java, Indonesia",
"Sun Microsystems", "9:00", "3:15" },
{ "Servlet Express", "2622", "505.95", "New Atlanta",
"New Atlanta", "9:30", "4:15" },
{ "Geek Airlines", "3.14159", "675.00", "JHU",
"MIT", "10:02:37", "2:22:19" } };
String flightString = "";
for(int i=0; i
String[] flightInfo = flights[i];
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved