VMWare Inc Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
1
of 1 vote

sendRedirect() sends a redirect response back to the client's browser. The browser will normally interpret this response by initiating a new request to the redirect URL given in the response.

forward() does not involve the client's browser. It just takes browser's current request, and hands it off to another servlet/jsp to handle. The client doesn't know that they're request is being handled by a different servlet/jsp than they originally called.

There are different situations where you want to use one or the other. For example, if you want to hide the fact that you're handling the browser request with multiple servlets/jsp, and all of the servlets/jsp are in the same web application, use forward() or include(). If you want the browser to initiate a new request to a different servlet/jsp, or if the servlet/jsp you want to forward to is not in the same web application, use sendRedirect().

- devan March 26, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

objects placed in the original request scope are not available to the second request

- myname March 02, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

So original request won't be available for both forward and reDirect as well.

- newbee March 02, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

u r wrong....same request object in forward while a new request object is used in sendRedirect....
so same request parameters can be retrieved in forward only!

- chandan prakash April 19, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Its available for forward

- myname March 02, 2011 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More