Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added start/end dates

  • Loading branch information...
commit 66a619f1db8ddb196a63010e1d3afa5aebef8216 1 parent 3f5a1b2
@markfisher authored
View
18 src/main/java/org/springsource/samples/web/TravelController.java
@@ -34,13 +34,19 @@ public String home(Model model) {
}
@RequestMapping(value = "/search", method = RequestMethod.POST)
- public String search(@RequestParam String zip, @RequestParam String start, @RequestParam String end, Model model) {
- logger.info("searching: zip=" + zip + ", start=" + start + ", end=" + end);
+ public String search(@RequestParam String zip, @RequestParam String startDate, @RequestParam String endDate, Model model) {
+ logger.info("searching: zip=" + zip + ", start=" + startDate + ", end=" + endDate);
+ model.addAttribute("zip", zip);
+ model.addAttribute("startDate", startDate);
+ model.addAttribute("endDate", endDate);
return "search";
}
@RequestMapping(value = "/book", method = RequestMethod.POST)
- public String book(@RequestParam String flightNumber,
+ public String book(@RequestParam String username,
+ @RequestParam String startDate,
+ @RequestParam String endDate,
+ @RequestParam String flightNumber,
@RequestParam String seatNumber,
@RequestParam String hotelName,
@RequestParam String roomNumber,
@@ -49,9 +55,9 @@ public String book(@RequestParam String flightNumber,
Model model) {
logger.info("booking: flight=" + flightNumber + ", hotel=" + hotelName + ", car=" + rentalAgency);
Itinerary itinerary = new Itinerary();
- itinerary.setUsername("joe");
- itinerary.setStartDate("to/do/01");
- itinerary.setEndDate("to/do/02");
+ itinerary.setUsername(username);
+ itinerary.setStartDate(startDate);
+ itinerary.setEndDate(endDate);
FlightReservation flightReservation = new FlightReservation();
flightReservation.setFlightNumber(flightNumber);
flightReservation.setSeatNumber(seatNumber);
View
4 src/main/webapp/WEB-INF/views/home.jsp
@@ -25,9 +25,9 @@
<form action="search" method="post">
Zip: <input type="text" name="zip"/>
<br/>
- Start: <input type="text" name="start"/>
+ Start: <input type="text" name="startDate"/>
<br/>
- End: <input type="text" name="end"/>
+ End: <input type="text" name="endDate"/>
<br/>
<input type="submit" value="Search"/>
</form>
View
4 src/main/webapp/WEB-INF/views/search.jsp
@@ -12,6 +12,10 @@
<P>Choose from these:</P>
<form action="book" method="post">
+ <input type="hidden" name="username" value="joe"/>
+ <input type="hidden" name="zip" value="${zip}"/>
+ <input type="hidden" name="startDate" value="${startDate}"/>
+ <input type="hidden" name="endDate" value="${endDate}"/>
Flight:
<select name="flightNumber">
<option value="FC123">First Class Airlines: 123</option>
Please sign in to comment.
Something went wrong with that request. Please try again.