Example & Tutorial understanding programming in easy ways.

Difference between forward() method and sendRedirect() method?

The  differences are as follows:-


Sno

forward() Method

sendRedirect() Method

1

The forward method implicitly called by the servlet

The sendRedirect() method is used for instruct the browser for url jump from orignal to the other one.

2

The browser is unaware about the on going of this method, so its url remain constant

In this method the brower knows and do the work for making new request.

3

If the brower window get refreshed then the url is relaoded with the same request and remain persisit.

The browser reload the second url and will not repet the orignal or old request but loads the second url

4

Forward methods works within the methods only.

SendRedirect works in and outside of the srver

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!