|
|
Page redirection is a procedure where the client is directed to a new location other than demanded. Page redirection is usually used when a document moves to a new location or may be since of load balancing.
The modest way of redirecting a request to alternative page is using method sendRedirect() of response object. Resulting is the signature of this method –
This technique sends back the reply to the browser along with the status code and new page location. You can also use setStatus() and setHeader() methods together to achieve the same –
This instance demonstrations how a servlet performs page redirection to another location –
Now let us compile above servlet and create following entries in web.xml
Currently call this servlet using URL http://localhost:8080/PageRedirect. This would redirect you to URL http://www.photofuntoos.com.
|
|
Java Servlets Related Tutorials |
|
---|---|
XML Tutorial | J2EE Tutorial |
JDBC Tutorial | JSP Tutorial |
EJB(Enterprise JavaBeans) Tutorial | Java Bean Utils Tutorial |
Java Servlets Related Practice Tests |
|
---|---|
XML Practice Tests | J2EE Practice Tests |
JDBC Practice Tests | JSP Practice Tests |
EJB(Enterprise JavaBeans) Practice Tests | Remote Method Invocation Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.