Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Darla Morrison   on Apr 13 In Java Category.

  
Question Answered By: Abana Cohen   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:
servletContext.getRequestDispatcher("/page2.jsp").forward(req,res);

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.

Share: 

 
 


Tagged: