final static Logger log = Logger.getLogger(ShowFlightInformation.class);
public String getName() {
return "ShowFlightsFrom";
}
public ActionResult perform(HttpServletRequest request) {
DAOFactory factory = DAOFactory.getDAOFactory(1);
String FlightsFrom = null;
FlightsFrom = request.getParameter("flightFromTo");
List<Flight> flights = factory.getFlightDAO().searchForFlightsFromAirport(FlightsFrom);
for (Flight flight: flights) {
flight.setDepartureAirport(factory.getAirportDAO().loadCountryName(flight.getDepartureAirport()));
flight.setDestinationAirport(factory.getAirportDAO().loadCountryName(flight.getDestinationAirport()));
}
ActionResult actionResult = new ActionResult();
actionResult.setUrlAddress("flt/ShowFlightsInformation.jsp");
if (flights!=null) {
actionResult.setUrlAddress("/flt/ShowFlightsInformation.jsp");