Which code has to be insert to redirect a resource by name 'resource.html' in the following code snippet?
d. request.getRequestDispatcher("./resource.html").forward(req, res);
I went for C & D. Also let me know if we can mention URLs to resources in the UNIX way using . and .. as has been done in the example. I thought they should either begin with "/" or some valid folder/resource name.
SCJP 1.4 90%, SCWCD5 94%, Next SCDJWS--> In Naescent stage. Researching abt exam and material itself.
Joined: Jul 24, 2008
the question specifically says redirect, so only c is the right answer not d. remember, with redirect the response goes back to the client(browser) and a new request is made by the client to the redirected resourse, whereas in forward, the response doesn't go the client, it simply forwards the request to the another resourse.
may be ./ is used in UNIX for / in windows. need confirmation from some unix user.