Which code snippet in the Front Controller servlet dispatches the request to the order retrieval servlet?

You have a simple web application that has a single Front Controller servlet that dispatches to
JSPs to generate a variety of views. Several of these views require further database processing to
retrieve the necessary order object using the orderID request parameter. To do this additional
processing, you pass the request first to a servlet that is mapped to the URL pattern /WEBINF/retreiveOrder.do in the deployment descriptor. This servlet takes two request parameters, the
orderID and the jspURL. It handles the database calls to retrieve and build the complex order
objects and then it dispatches to the jspURL.
Which code snippet in the Front Controller servlet dispatches the request to the order retrieval
servlet?

You have a simple web application that has a single Front Controller servlet that dispatches to
JSPs to generate a variety of views. Several of these views require further database processing to
retrieve the necessary order object using the orderID request parameter. To do this additional
processing, you pass the request first to a servlet that is mapped to the URL pattern /WEBINF/retreiveOrder.do in the deployment descriptor. This servlet takes two request parameters, the
orderID and the jspURL. It handles the database calls to retrieve and build the complex order
objects and then it dispatches to the jspURL.
Which code snippet in the Front Controller servlet dispatches the request to the order retrieval
servlet?

A.
request.setAttribute(“orderID”, orderID);
request.setAttribute(“jspURL”, jspURL);
RequestDispatcher view
= context.getRequestDispatcher(“/WEB-INF/retreiveOrder.do”);
view.forward(request, response);

B.
request.setParameter(“orderID”, orderID);
request.setParameter(“jspURL”, jspURL);
Dispatcher view
= request.getDispatcher(“/WEB-INF/retreiveOrder.do”);
view.forwardRequest(request, response);

C.
String T=”/WEB-INF/retreiveOrder.do?orderID=%d&jspURL=%s”;
String url = String.format(T, orderID, jspURL);
RequestDispatcher view
= context.getRequestDispatcher(url);
view.forward(request, response);

D.
String T=”/WEB-INF/retreiveOrder.do?orderID=%d&jspURL=%s”;
String url = String.format(T, orderID, jspURL);
Dispatcher view
= context.getDispatcher(url);
view.forwardRequest(request, response);

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *