| Author |
Redirecting to static resources
|
Kamal Tripathi
Ranch Hand
Joined: Oct 02, 2008
Posts: 86
|
|
Source: Javabeat Mock Exam
Which code has to be insert to redirect a resource by name 'resource.html' in the following code snippet?
a. res.sendTo("./resource.html")
b. request.sendTo("./resource.html")
c. res.sendRedirect("./resource.html")
d. request.getRequestDispatcher("./resource.html").forward(req, res);
e. res.forward("./resource.html")
Answer: C.
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.
|
Kamal Tripathi
SCJP 1.4 90%, SCWCD5 94%, Next SCDJWS--> In Naescent stage. Researching abt exam and material itself.
|
 |
nisha chidella
Ranch Hand
Joined: Jul 24, 2008
Posts: 57
|
|
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.
|
SCJP 5.0(100%)
Preparing for SCWCD
|
 |
Milton Ochoa
Ranch Hand
Joined: Oct 23, 2007
Posts: 336
|
|
|
nice explanation
|
 |
 |
|
|
subject: Redirecting to static resources
|
|
|