Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

What is the difference between sendRedireect method and jsp:forward ?

  Asked By: Darla    Date: Apr 13    Category: Java    Views: 1193

What is the difference between sendRedireect method
and jsp:forward ?
What is http tunnelling ? Explain with an example .
What are all the ways to store the all objects in
servlet ?



1 Answer Found

Answer #1    Answered By: Abana Cohen     Answered On: Apr 13

> What is the difference  between sendRedireect method
> and jsp:forward ?

<jsp:forward> is a tag. Underneath the tag, the code should be
something like this:

Meaning: When generating the response String, the req, res objs are
forwarded to another page in the server. So, you can have part of page
1 followed by page 2 in the same response. It is like passing a baton
in a race.

response.sendRedirect() is a HTML based feature. It sends a redirect
header to the browser, and the browser will load the new page. (NOTE:
there are 2 req/res cycle here)

> What is http  tunnelling ? Explain with an example  .
not sure.

> What are all the ways to store  the all objects  in
> servlet ?

Not sure what you mean.
Try not to store objects as instance variables in the servlet class.
Use request.setAttribute, session.setAttribute and
servletContext.setAttribute. In this way, you are less likely to mess
up with synchronization issues.