About Question enthuware.jwpv6.2.1046 :

Moderator: admin

Post Reply
ETS User

About Question enthuware.jwpv6.2.1046 :

Post by ETS User »

The question says "you want to redirect the request to another resource which may or may not be a part of the same web application."


The explanation says that forward() works if the resource that is going to take the request is part of the same application, and sendRedirect() works fine if the resource is outside the web application...ok I knew that, however, it is not clear to me why the correct answer is :

3. response.sendRedirect("some url");

If forward() works within the same application, and sendRedirect() outside, and it cannot be predictable whether or not the resource that is taking the request is in the same application, I think that sendRedirect works for both situations, is that right???

Thx

admin
Site Admin
Posts: 10385
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1046 :

Post by admin »

The explanation does not say that sendRedirect works only for a resource outside the webapp. Since it causes the browser to send a new request, it doesn't care whether the resource is in the same webapp or not. So it works for both the case. THat is why this is the correct answer because you don't know where the resource is.

HTH,
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests