The code snippet to access FrameworkViewSelector in controller is given below:
FrameworkViewSelector selector = FrameworkViewSelectorIml.getInstance();
String nextJSP = selector.getNextPage(request, FrameworkViewSelector.SUCCESS);
Next, the Front Controller servlet must send the request to nextJSP to generate the view.
Assume that the servlet variable request is assigned the current HttpServletRequest object and variable context is assigned
the webapp's ServletContext.
A. Dispatcher rd= context.getDispatcher(nextJSP);
B. Dispatcher rd= request.getDispatcher(nextJSP);
C. RequestDispatcher rd= context.getRequestDispatcher(nextJSP);
D. RequestDispatcher rd = request.getRequestDispatcher(nextJSP);
Given answer : D
I think the answer can be C as well even though only one option can be chosen.
The question does not say nextJSP starts with "/" or not.
If nextJSP starts with a "/", that means it is a relative path to the context .