Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
Since forward() method of RequestDispatcher is
handled on the server ,
therefore the request and its associated session are
available to the forwarded resource and you can pass
data between them using request.setAttribute(). forward()
separates the
responsibilities for handling the requests
among several components. This method generally sends a request
and response
object to resources (servlets or
JSP's) of the same ServletContext.
RequestDispatcher.forward() and PageContext.forward() are
effectively the same
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/web/tes.jsp");
dispatcher.forward(req, resp);
sendRedirect() method of a response object sends the url
to the browser that includes the parameter of sendRedirect()
method Browser treats this a new request from the client.
sendRedirect() forwards a requests to a resource outside of
the
current web application. Using sendRedirect is similar to open a new browser
and type your url. A sendRedirect() also updates
the browser history and transfers control only when the whole
service method completes. There is only one way to pass data
is
through the session or using web parameters
(url?name=value).
resp.sendRedirect(""/web/tes.jsp"); // Considered as new Request in the browser
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.