Java Reference
In-Depth Information
ServletContext context =
servletConfig.getServletContext();
ApplicationContext appContext =
WebApplicationContextUtils
.getWebApplicationContext(context);
B
Creates
PlaceOrderService
service = (PlaceOrderService) appContext.getBean(
"PlaceOrderService",
PlaceOrderService.class);
bbbbbb
...
}
protected void service(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
C
Validates
parameters
if (!validateParameters(request,
response))
return;
Address deliveryAddress = makeDeliveryAddress(request);
Date deliveryTime = makeDeliveryTime(request);
HttpSession session =
request.getSession();
String pendingOrderId =
(String) session.
bbbbbbbbbb
b
➥
getAttribute("pendingOrderId");
D
Gets pending
order ID
PlaceOrderServiceResult result =
service.updateDeliveryInfo(
pendingOrderId,
deliveryAddress,
deliveryTime);
E
Invokes
PlaceOrderService
PendingOrder pendingOrder = result.getPendingOrder();
F
Stores pending
order ID
session.setAttribute(
"pendingOrderId",
pendingOrder.getId();
G
Determines JSP
page to invoke
switch (result.getResult()) {
case PendingOrder.OK :
displayAvailableRestaurants(
request,
response,
deliveryAddress,
deliveryTime,
Search WWH ::
Custom Search