Hi Java Gurus
can any one tell me how can I redirect the response from other web pages to my own page?Should I have to use URLConnection class also?any one can just help me out
What i understand is u want to redirect from one jsp to another, if thatz ur requirement use
Some info about the response.sendRedirect() and jsp:forward.
response.sendRedirect() will generate another HTTP request from the client's browser. This means that the servlet is actually handing over the control back to the browser and ask it to generate a fresh request.
<jsp:forward> actually internally hands over the control to another forwarded page. this way, new request is not generated.
In other words, response.redirect is executed at the browser but the <jsp:forward> is executed at the web server. sendRedirect is useful when u want to transfre the control to another web site all together, for example. but if u want to transfer the control within your web site or web application, use <jsp:forward> coz it is much faster as it is executed on the server itself. If u wanna give the same effect in servlet, u can user javax.servlet.getServletContext().getRequestDispatcher("jsp or html file name").forward(requestobject,responseobject).
getRequestDispatcher("jsp or html file name")
"jsp or html file name" is an url?