aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Redirecting to static resources Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Redirecting to static resources" Watch "Redirecting to static resources" New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirecting to static resources
 
Similar Threads
question from JWebplus1.4 about session.invalidate()
TimerManager Problem
Get values from a servlet
DSN name not found error with TOMCAT5.5.7
Multiple Instance of Web Application end Up Using Same JCA Resource