Difference between forward and sendRedirect

forward

Control can be forward to resources available within the server from where the call is made. This transfer of control is done by the container internally and browser / client is not involved. This is the major difference between forward and sendRedirect. When the forward is done, the original request and response objects are transfered along with additional parameters if needed.

redirect

Control can be redirect to resources to different servers or domains. This transfer of control task is delegated to the browser by the container. That is, the redirect sends a header back to the browser / client. This header contains the resource url to be redirected by the browser. Then the browser initiates a new request to the given url. Since it is a new request, the old request and response object is lost.

For example, sendRedirect can transfer control from http://javapapers.com to http://anydomain.com but forward cannot do this.

‘session’ is not lost in both forward and redirect.

To feel the difference between forward and sendRedirect visually see the address bar of your browser,
in forward, you will not see the forwarded address (since the browser is not involved)
in redirect, you can see the redirected address.

When can we use forward and when can we use sendRedirect?

Technical scenario: redirect should be used

  1. If you need to transfer control to different domain
  2. To achieve separation of task.

For example, database update and data display can be separated by redirect. Do the PaymentProcess and then redirect to displayPaymentInfo. If the client refreshes the browser only the displayPaymentInfo will be done again and PyamenProcess will not be repeated. But if you use forward in this scenario, both PaymentProcess and displayPaymentInfo will be re-executed sequentially, which may result in incosistent data.

For other than the above two scenarios, forward is efficient to use since it is faster than sendRedirect.

Ads by Google

Example for forward and sendRedirect based on real world

Consider the real world scenario, the milk man comes and asks for monthly payment to you in your house. Here house is the container and you are a resource existing in the container. Milk man is the client or browser.

He asks for the monthly payment to you, this is the request made by the browser to resource A. If you go inside your house and ask your mother (another resource B inside the same container) for the cash and come back and deliver to milkman this is called forward.

If you ask the milkman to speak himself to your mother inside your house or you ask the milkman to speak to your father who is in his office (different domain) then this is called redirect.

This JSP tutorial was added on 13/05/2008.

«

»

Comments on “Difference between forward and sendRedirect”

  1. Sarma

    Hi,

    Thank you for your excellent work. I liked the example you have given here for the difference between forward and redirect.

  2. Aatish

    Brilliant example! :)

  3. Tan Ho

    Very good explanations for forward and execellent example for the difference

    Thank you!

  4. chandana

    Ha ha ha thats a gr8 example….

  5. Ramkrishna

    really good explanation for difference between forward and redirect and practical example.

  6. mtl

    Very good! Thanks a lot.

  7. dipak sonawane

    awesome style to explain this scenario,
    I was really searching on internet for the real example for sendRedirect and forward. Finally I found from this article … thanks a ton

  8. Priyanka

    Finally, I know the difference between forward and sendRedirect :P . Thanks a lot.

  9. sarayu

    Nice Explanation. Thank You

  10. Anonymous

    Good points detailing out the differences and mentioning when to use what. Thank you.

  11. SAILESH

    Hi,

    Forward and redirect difference example is good .

    I have read this blog and this is really very good to read as in the example understood.

    I think if every topics related to java or advance java will be written like this with example then it is easy for everybody to understand.

    Thanks

  12. In the technical scenario given above – for payment & display of result, why do we need client interaction? Correct me if I am wrong.
    for example, the user does a payment by clicking Pay Now button. In most of the online payment sites, there will be a warning saying – do not press fresh button or back till you get a confirmation message – I think in this scenario, forward is happening. Please let me know whether my understanding is correct? ( email pn8572@gmail.com)

    regards,
    Prasanth

    • Gopal Rao

      Prashant,In the scenario of the online payment when the sites give a warning saying “Please do not press the back or the refresh button” they are using redirect not the forward.Because once the payment is successful then again its getting redirected to a different page which is showing the payment successful information.

    • Swaraj

      Hi Prasanth,

      In the payment and Displayinfo once fill informaion on merchent page(info)related once we presss the submit button then internaly it will goto payment site if u want conformation see URL(exp: flipcart==> to anybanksite) then in this time it will show dont press refresh button or back bcz if u prsss payment is not completed so transaction is not completed so transaction is rollback bcz of that it will show error page. once payment is sucesses then it redirect to merchentsite.now if u press refress button it wil show only displayinfo will refreshed but it wil not called payment.

  13. ali

    It is an excellent and crisp definition.thanks for such a explanation.

  14. Jagdish Adhikari

    Really very logical real time explanation of forward & sendRedirect , great work

  15. Biswabrata Banerjee

    This site is the best among many !!
    Great !

  16. srinivas

    Simply superb. Nice Explanation with real world example for forward and sendredirect

  17. Vamshidhar

    Fabulous!!!! Really great thinking in real world against the technologies.

  18. Supri

    Hi..

    Really too good.In many websites they just give the definition.And only in this blog i got it cleared.Thanks.

  19. difference between forward and redirect is now crystal clear.
    vvvvvvvvvvvvv good explanation with genaral example.

  20. Praveen Kumar Jayaram

    You rock Joe! That was really helpful :)

  21. aryan

    Awesome example…. keep up the good work!

  22. Srikanth S

    Excellent Joe….Real world example is too good..

  23. nagarjuna

    Finally, I know the difference between forward and sendRedirect :P . Thanks a lot.

  24. Saravanan

    Excellent example for forward and redirect. Great Work and Great thought…Keep the good work…

  25. Saubhik Aon

    Excellent work!!! really it will help lots of people who are trying to understand forward and sendRedirect….really great job….even the last example is awesome.

  26. Hi
    Very good discription ;
    thanks

  27. Bhanumat

    Excellent Joe. Real world example is very clear.
    Thank you for your work.

  28. Murali

    I liked the milk man example..vry short and 100% clear…

  29. Bala

    Wow This is very helpful to understand the core concept of forward and sendRedirect. The examples above gave very clear understanding of the concepts. Keep posting lots of topics.

  30. naba

    nice example…. thank you for your excellent work…

  31. Pragati

    Hello,
    Thanks I liked your Example.

  32. preity

    Thanks…Nice explanation

  33. Chirtrarasan

    Thanks…… and I can understand your explanation easily

  34. arvind

    I find this site to be unlike from the others. I would like to appreciate your work & passion…simply superb!!!

  35. vinay s salunke

    HI Joe,

    I really liked the example and enjoyed learnng the concept.

  36. Rajaram

    Haha.. Very Funny Example and very indepth explaination

  37. Palmeet

    Excellent Real world example is too good..
    i mean it understands very easily……….
    thanks buddy…

  38. Uttam

    Very good example of difference. nice..

  39. veeraswamy

    this is very nice explanation example of forwad and senddirect.is there any other type of examples are there.pls forward to my mail.thanks

  40. parvathy

    Very nice article, Could you please include spring and hibernate in this site.

  41. Siva

    Very good explanation. As somebody suggests plz. update springs and hibernate in this blog.

    Thanx again

  42. Shaye

    Thanx a lot.. This info really helped!!

  43. anbu

    HI Joseph,
    Excellent work!
    thank you!
    Could you please include spring,struts and hibernate in this site with real world examples!

  44. venkat

    this is very usefull for me.

  45. Anonymous

    excellent example…

  46. this is it!!!!!!!!!!!!!!!!!!!! what many looking for as well as i.

  47. Magesh

    thanx… a lot

  48. Ashok

    Thanks a lot for explaining the difference between forward and redirect in simple way..

  49. Rangappa

    hi…
    Its very nice to uderstand with examples…
    its very nice if u explation other topic (j2ee and advance topics)….
    very very nice….

  50. Priya J

    I could understand your example very well. But there is a confusion with a real time situation that I’m thinking about.

    If you go to irctc.co.in for payment it will redirect you to netbanking application. At that time since this is a redirect it’s a new request and the old req/resp will be lost. But once payment is done it is going back to the irctc.co.in. Where this url is preserved? in the session?

    It would be very helpful if you clarify the situation mentioned above.

    • Niraj

      There is an attribute of HTTP Header called referer (actual spelling referrer) which will always keep track of the last URL from where the request is being made.

  51. Amutha

    Thanks Joseph

  52. Anonymous

    Nice Example with good explanation

  53. Anonymous

    Very good explanation…………..

  54. C.P.Singh

    Thanks for good explaination with good examle

  55. bsr

    gd explanation….besides i demond code examples….

  56. Anonymous

    Simply awesome !!

  57. Sekahr

    Hi boss.
    I got a good explanation after a long time.
    Thanks.

  58. Raju

    Very nice explanation…
    thx.

  59. nani

    very nice example,it helps me a lot

  60. shashi

    Hi,

    Thank you for your excellent work.

  61. Sunil

    Super job!! the examples are very clear to understand the concepts

  62. Manoj

    really nice …explanation and example

  63. krishan

    brilliant presense of mind

  64. abhishek

    nice explanation, thank u very much..

  65. Jyotshna

    its really awsm….
    thnks..

  66. Udhay

    i never seen such a simple example like this for forward and redirect… thanks a lot

  67. Kishore

    Good Explaination.

  68. kuzma

    nice work!

  69. sureshsp

    Excellent you have given such nice explanation.The way your writing and explaining every thing perfect

  70. Kinjan Ajudiya

    nice explanation but if you can give example of forward then it is good …thanks

  71. I could understand your example very well. But there is a confusion with a real time situation that I’m thinking about.

    If you go to irctc.co.in for payment it will redirect you to netbanking application. At that time since this is a redirect it’s a new request and the old req/resp will be lost. But once payment is done it is going back to the irctc.co.in. Where this url is preserved? in the session?

    It would be very helpful if you clarify the situation mentioned above.

  72. Joe

    @elangovan
    Thats a very nice question relating to the context.

    Here this is a redirect and there is no doubt about it. irctc (web application) is integrated with the payment gateway. While integrating, there will be provision to set the callback url and the list of arguments that needs to be passed back to the web application. So, once the payment is done, the payment gateway will call the registered url (in this case irctc). So there is no need to preserve the url in session. The call will be done by payment gateway.

    Some additional information:

    Internally there will be another url involved called notify url. On payment, this notify url (in the irctc web application) will be called along with status variables. This will happen in a notify-acknowledgement mode. Using the status variables, webapplication (irctc) can update its database or execute process like sending an email (ticket) to the user.

  73. Reji

    Great example !!! Nice work…

  74. nikita

    nice work…n a very gud example to explain the difference.

  75. Dhanunjay

    Nice way of explaining the difference b/w forward and redirect…

  76. sridhar

    awesome example, which makes crystal clear between forward and Redirect.

  77. Nitin

    can anybody tell me where the request and response objects will go in both the cases

    what i think about
    -redirect
    that in this case previous req n res will be destroyed when control is transferred to another page

    -forward
    req n res will transferred to another page along with the control

    n pls tell me about the include also.. i think in this case previous req n res comes back to the same page after transferring the control

    please correct me if am wrong….

  78. balu

    nice example

  79. Priya

    the examples are very clear

  80. malli

    good solution

  81. C.P.Singh

    Thanks to share the good explanation with real example
    @C.P.Singh

  82. Hi Joseph,

    When i click redirect in jsp it will go to struts and will call funtion redirect i..,
    public void redirect() throws IOException, ServletException
    {
    HttpServletResponse res = null;
    res.sendRedirect(“www.google.co.in”);

    }

    here i want to redirect(i want to change the url in address bar using sendredirect) but it is throwing nullpointer exception)
    how can i get from this.
    pls help me……..

  83. eshwar

    kalakara kolandha

  84. eshwar

    Its really helpful for me to study thank you dude

  85. Deepak

    theory was good thank u for that and could u please post some example programs :)

  86. swathi chintala

    very very nice example.wonderful xplanation.

  87. Rama

    Nicely explained… Good Job

  88. Once if we have this type of real time explanations, at that time we can’t forget the concept. . .
    Anyhow superb explanation. . .

  89. Om

    Very good example. Thanks

  90. radhakrishna

    Thank you a lot. This is really very useful. keep blogging.
    Thanks again…:)

  91. Badari

    Excellent Example

  92. anonymous

    very very good and clear difference b/w both of them and with a good example

    Thanks very much…for sharing these things….!!!!

  93. Nandhini

    Good example……..

  94. Anonymous

    excellent example gr8!!
    Sanjay

  95. GK Than

    Great….

    Example is super, is it helps lot to remember the concept……

    Great again

  96. Anonymous

    It a Good Example for ever

  97. Anonymous

    Hi

    It is Very Good Example and we can Remember easily.

  98. Anonymous

    What a funny example!

  99. Saoni De

    Thank u very much for giving such an exellent example

  100. nice realworld example………

  101. Naveen Sharma

    Hi Joseph,
    I appreciate your initiative for the beginners help,Your blog is very much helpful for me to remove confusion about this topic . you right great example of payment process . It is very much practical example i have found .

    Thanx allot.

  102. shakti prasad rath

    This is really a good solution. Thanks for this solution

  103. Anonymous

    Hi thanks a lot. This is really good
    example.

  104. aaj antar samjh aa gaya forward or redirect mein …………. wonderfull example

  105. vivek

    gud work:-)))

  106. kondaveeti somasekhar chowdary

    superb explanation. . .

  107. Sandhya

    nice Example :)

  108. Partha

    Great man….nice and very very helpful example.

  109. Anonymous

    nice explanation(example is very good easy understandable)

  110. Anonymous

    perfect example.. too good

  111. pramiya

    nice work!!!!!!!!

  112. Rajkumar.G

    Nice example.

  113. shilpa

    awsummmmmm

  114. samina

    very well example!

  115. chaitu

    good explanation ,

  116. Anup

    Hi,

    Thanks Joe.

    I have gone through most to the link to get my answer ‘to the point’ but i never got my answer up to satisfactory label.
    In this link i got my answer ‘to the point’ with wonderful example.
    Thank you Joe once again. Please continue as long as possible.

    Thanks & Regards
    Anup Shrivastava.

  117. THIS IS AWESOME REAL TIME SCIENARIO EXAMPLE .

  118. Praveen

    Hi Joe,

    Example explained the whole concept clearly . Thanks a lot .

  119. Anonymous

    Excellent Example

  120. shivanand

    really great work sir…

  121. Sudhir Rana

    Excellent Example

  122. Dushyant

    good one

  123. Darshan

    really gr8 work

  124. Apurva

    Excellent differences….

  125. Yogendra

    Its really great difference…

  126. Anonymous

    Great example..thank u

  127. Anonymous

    Please provide Spring concepts also..

  128. Ganesh

    i like ur webSite.it id really helpfull

  129. Muruga

    It seems to be like a pictorial example. good work keep going

  130. Anonymous

    very nice explanation

  131. harjinder

    Nice explanation with example

  132. Deepak

    Very nice explanation with exaple

  133. shilpa

    Hello,
    I am a beginner in JAVA and the concepts explained here are very good and real life examples make it even more clear.

    thanks…
    i am lucky to have come across this website..
    its indeed really helpful…

  134. reshma begum

    Hi.. Nice example to understand better…:):):)

  135. Tekuri

    Hi Jo, Very good! Thanks a lot. keep it up…

  136. Anonymous

    Nice explanation

  137. bhaskar

    thank u …..

  138. Rajeev

    What a brilliant example.

    Thanks

  139. What a wonderful example. I like this example. Thank you so much

  140. Kulanthaivelu

    Hi Boss.

    very thanks boss. Super example.

  141. Pramod Rajane

    Thanks….

  142. vishwash

    Very Good explanation

  143. Kavitha

    Good Explanation

    Thanks

  144. prathip

    REALLY SUPERBBBB… No one can give example more than this…

  145. indu

    Simple & worthy explanation. Good Work!!

  146. tnx .

    its every easy to understand forward and redirect example

  147. Jeen

    good explanation with great examples… thank u..

  148. Anonymous

    Explained the concept clearly and in a very simple way. Good Work

  149. naveen

    good work..thanq

  150. Anonymous

    Very nice explanation in very simple language.

  151. Ravali

    Hi Joe,

    That was awesome explanation with the real time senario in simple language.

  152. rekha

    hello sir..

    itz really a very good explaination.. thank u so much sir..

  153. Anonymous

    S………….. of course it’s good

  154. Salim

    awesome example of class level and real time level.
    I am really impressed by this example

  155. Senthil

    Very nice explanation. Please keep posting these kind of explanations.

  156. Ramesh

    very good explanation with great examples… thank u..

  157. Anonymous

    good explanation ………Thank q….

  158. Mujeeb

    very nice Explanation ,,,,,,,,,,,

  159. jagan

    Nice Explanation.:-)

  160. Anonymous

    nice article. bt when i tried, send ridirect is not working for other domains, i mean control is not going to the pages that are out of the web application

  161. Anonymous

    sorry,i got it.by using response.encodeRedirectURL(“destination”);

  162. pothis

    good work .. keep it up !!!!!!!!

  163. Java Learner

    Joe,

    Agreeing to all, nice example to explain.

    Suggesstion:

    Can you please keep all your ‘thank you’/appreciation threads seprate or collapsable.

    Some ppl do post additional info and finding them b/w umpteen thankyou’s is difficult.

    Why not, assign a star on article, on evry appreciation recieved :)
    thats how notebook should look like , starry

  164. Anonymous

    Excellent defenition and example…Joe…

    Keep on posting….

  165. Joe

    @Java Learner, thanks for taking time to stop by comment. Let me see and fix it in the near future. :-)

  166. KOMAL

    great..!!!!
    EXCELLENT EXAMPLES. :)
    i LIKED IT

  167. Anonymous

    Good Job Joe. I have good experience in java. i really liked the point ‘TO ACHIEVE SEPERATION OF TASK’ and the way you presented this point with example.

  168. SKS

    Good Job Joe. I have good experience in java but i really liked the point ‘TO ACHIEVE SEPERATION OF TASK’ and the way you presented this point with example.

  169. vijay

    Awesome Example you given!

  170. Anonymous

    Great Example… I really understand the concept of both redirect and forward..

  171. Anonymous

    servlet is threadsafe or not… I want to know this concept exactly.. can anyone explain this…

    • Niraj

      Servlet is not thread-safe by itself because of performance overhead. Prior to Servlet 2.0 to make it thread-safe you need to implement
      SingleThreadModel interface but its deprecated and can be removed from future version.
      You can make your Servlet thread-safe by making the service method synchronized.

  172. laxmi

    Love this.. Keep up the good work.

  173. Santhosh Kumar R

    Hi Joe you site is super and nice explanations to be understand by anyone. Admiring your interest in Java,

  174. gaurav

    excellent example but only one statement is wrong dear that is “Control can be redirect to resources to different servers ” in case of sendredirect we can forward the request to another web-app but they should run under the same server only.

  175. pankaj vaswani

    It was never clearer to me before.

  176. irfan

    very nice explanation :-)

  177. Neeraj

    Really its very good real world example,now i can’t forget it till my life:-)

  178. Sunil Sharma

    Really nice article.
    Very well example.

  179. Amit Agrawal

    Good Explaination

  180. Sunil kumar

    nice Example ..Thanks joe.i’ll never forget it.

  181. KarpovMohan

    Thanks Joe…
    Well explained !!!

  182. kanishka

    thanks plzzzzzzz help me in other topic also.

  183. Anonymous

    yeah this one….

  184. Tebar

    Very clear, Thanks a lot.

  185. viresh parikh

    Very clear example.
    Thanks
    :)

  186. hiren

    I loved the real world example.. good one!!

  187. Sangeetha

    Very catchy and interesting real world example. Thanks Joe

  188. FIroj

    Joe, u rocks …love dis blog ….keep up ur enthusiasm and good work …

  189. Anonymous

    nice real world example.good job.Thanks a lot

  190. neel

    does browser retains Cookies when redirecting to another domain?
    e.g. if Domain A sets a cookie in response before doing redirect to Domain B, will browser retain that coookie while creating new request for Domain B?

  191. Dinesh

    Please have this comment section with categories such as “Appreciations”, “Improvement” and “Q&A”.

    More over..It would be good if this comment section is expandable, rather than a long list on a single web page.

    Thanks.

  192. prakash

    Hi Sir,

    Thanks for the wonderful explanation with examp. My doubt got cleared

  193. arpit mishra

    Hi Joe
    You rock . only because of ur notes and real world example i got the job.

  194. sndpguru

    Thanks Joe for such an explanation, the answers in this website are class apart.

  195. Anonymous

    Awesome Article. Keep going.. thanks.

  196. Anonymous

    Awesome answer

  197. Hari

    hi,i have a doubt to use send Redirect method.
    when i implimented redirect method in my action class , how i hide parameters from users.

  198. shahid

    its very helpful to me in my mejor project making.thanks a lot

  199. pavan_krishna

    simple superb

  200. pavan

    Beatuiful example.! :)

  201. Minh

    I have wonder your statement:
    ‘session’ is not lost in both forward and redirect.
    Because I know session will be lost in redirect.

    Please correct me if i am wrong .

  202. dhanya

    The real time example cited here makes to understand the whole concepts.

  203. Anonymous

    Can you plz further elaborate this example in terms of session? What will happen to the objects that are stored as request attribute?

  204. JP

    Your realtime example narrated for this concept is simply superb.

  205. Vj

    Thank you!

    /Vj

  206. Anonymous

    Very good Example Dear friend….. Follow this ways… I understood easily..

  207. Shashi

    Good example.. this shows how to describe difficult scenario in an easy way !!!!!!!!!!!!!!!!

  208. ank_057

    awesome example…..you changed my life…..thankk you!!!!

  209. Surya

    Excellent Example…!!!! now only i have got clarity between forward and sendRedirect techniques…!!! thanks a lot…!!!

  210. santosh

    Good Explanation with.. Good Examples.. really i like it..

  211. Jaffar

    Awesome stuff brother!God bless you!

  212. Anonymous

    really helpful and very clearly explained,thanx a lot.

  213. amrita

    could not help appreciating your way of explaining..it really made the concepts crystal clear…thank you… u rock..

  214. Nilesh

    Excellent Example

  215. chittaranjan padhi

    gr8 example….

  216. prasad

    Thanx

    very best example

  217. saurabh

    Thanks Joe.
    Superb example …!!!

  218. sweety

    Thank you. I liked the real time example. It made me understand the concept easily.

  219. Anonymous

    Excellent example.

  220. Punam

    I like the real time example very much..it’s really help me a lot…thank you very much joe

  221. deepak patidar

    A lot of Thanks, here real world example is very good,and i want to give thanks again for this.

  222. mani

    superb example

  223. Priya

    Very nice example. This site is very good, understandable.

  224. Sheeba

    brilliant exampleee!!!!

  225. sneha

    clear examples!

  226. Badal

    really great…thanks a lot..

  227. Deepa

    gr8 example…

  228. kumar

    very nice example joe.. thnx

  229. Mahesh

    Its very good answer… Thanks

  230. ankita

    fantastic example to understand the difference between forward an redirect

  231. parthimahesh

    Hi,
    this is very good examble…
    easily understand the difference.

    thanks a lot.

  232. sudha

    Thanks JOE

  233. sai ganesh

    Simple and straight explanation. Thanks.

  234. Shweta

    This is a really simple to understand !!

  235. muthus

    Thank you for such a simple explanation

  236. Anonymous

    Thank u sir….

  237. thomas

    Really good example

  238. Anonymous

    DAMMMMMMMMM goood

  239. bachan

    nice example

  240. Deepak

    Its damn good explanation…

  241. prasadreddy

    good explanation

  242. Sharmi

    thank u so much for giving this simple example. ur explanation is realy very good.

  243. khasim

    you awesome man….brilliant explanation.

    khasim on july 30th,2012 2:28 am.

  244. khasim

    you awesome man….brilliant explanation.

  245. Gopal Gowda

    Nice explanation and good example too.

  246. Manikandan

    very nice example.great one too

  247. Ammu

    Gr8 explanation. Thanks for sharing

  248. sushree

    it makes me very clear about sendRedirect and Forward…thank u very much..

  249. Aman

    Milk man example are very good..
    thank u very much..

  250. chandu

    very nice example..

  251. ram

    it is very clear about it.

  252. thanks a lot joe , really you have given great example which can help anyone….

  253. Anonymous

    Very nice explanation!!!!
    Thank you Joe :-)

  254. Bhushan

    Example of Dudhwala is awesome:) Please add some tutorial on jQuery, if you are expertise in it.

  255. Anand

    you are simply superb :)

  256. Anonymous

    Very good Explanation…

  257. Anonymous

    good example

  258. suma

    explanation was very clear

  259. fsffd

    Nice Explanation. Thanks a lot.

  260. Swati

    Really nice explanation .

  261. Anonymous

    Well explained

  262. Shakil

    Great example and very good explanation in simple words.

    like all your posts, keep up the good work!

  263. Wow… what a great real time example….
    There exist @Joe.

  264. Anonymous

    nice one.
    pooja on 6/9/2012 4:15 pm

  265. vino

    Excellent thanks

  266. vino

    Excellent thanks

  267. bala

    Very good explanation..

  268. swati

    Hi,

    Really it’s Great example.

  269. Ajay

    Excellent work !! thank you.

  270. Anonymous

    Thanks Yaar , finally i understood here in this website

  271. Konica Pal

    Good Explaination… Thanks

  272. mahendar K

    Great Explanation sir.learning fromm this explanation is like a cakewalk.

  273. Anonymous

    Hey thanks. I understood the concept now.

  274. srini

    Very good explanation, Now i understood a great sir,

  275. Chennakesava Reddy Vustalavaram

    Wonderful example Joe….

  276. Anonymous

    Thanks a lot….got idea on topic

  277. Nehal

    Wonderful example

  278. Anonymous

    Nice Website. Good Work.

  279. ajith

    i understood..crystal clear…

  280. Mangesh

    nice example

  281. Shashikant

    Excellent real time example.

  282. Aniruddha

    The difference u explained between forward and redirect is like a bulls eye…

  283. Janhavee

    The difference is superbly explained…hats offf..!!

  284. dipanshu

    Hi its really nice blog that you have maintained specially the example of forward and redirect was amazing.

  285. Anonymous

    Superb Article.I like the example.

  286. Thankyou

    Very Nice ☻

  287. Jeevan

    Nice example

  288. krishna gupta

    nice explanation. thanks a lot

  289. Sutapa

    Thanks a lot.

  290. Lalitha G

    Well explained! Thanks!

  291. Pavan

    I liked the milk man example. It is fantastic. Understood the concept very well.
    Many Thanks,

  292. Priya

    Very easy to understand..luking forward for blog like
    oraclepapers from you :D

  293. Akshaya Gawand

    Thanks Joe! This helped!!

  294. Mahesh

    great explanation……..

  295. Anonymous

    Ok . fine..

  296. Anonymous

    fine example.. Keep up the good work…

  297. sagar

    excellent answear…………

  298. Saranya

    Really Superb explanation..!!

  299. Tarun S. Pandey

    Hi Joe, Nice examples you have given as well as explained. Your IRCTC example is also perfect. This also happens when we use Paypal Payment Gateway or similar. Good job!! Keep it up!! :)

  300. Anonymous

    Thank you so much .. you explain concepts so well

  301. santhanam

    Thankyou joe,
    Your real time example is easy to understand by us.keep give this type of real time example to other subject also …
    all the best.

  302. Jayesh Kalkani

    this is the best tutorial for all the beginners who have doubts in forward and sendRedirect…
    thank u very much….

  303. vikash

    Excellent… mind blowing…Very good explanation with extremely good example.

  304. Anonymous

    Nice explanation yaar.

  305. shiva

    Hello boss
    wow!
    good example its really nice piece of example.

  306. hari prasad reddy

    Amazing real world Example,please provide this type of examples to other topics also.It is easy to understand.

  307. fuNi

    Nicely said

  308. Rana

    Really a very good example boss

  309. Vish

    Cool stuff! Really liked the milk man example :-)

  310. Snehit

    Very good explaination with real world examples.Good job.

  311. Manoj Patil

    nice example

  312. Venkat

    I have a query.

    I have a jsp with all costants.I want to use those value in a servlet(which calls by the web.xml at the loading the server).

    How can I achive this?

  313. Priyam

    Hi Amigo,

    really good example and simple to understand.

  314. Anonymous

    Nice Explination Joe

  315. Snehal

    Amazing example. It helped to understand the tricky part in simple way. Thank You

  316. Jay

    Brilliant work… Thanks

  317. Anonymous

    Good Discription

  318. Anonymous

    Good Description

  319. sri

    Good explanation with a simple example

  320. vignesh

    A good one with an apt example..!!

  321. sudarshan

    Nice example

  322. chethan

    Nice description about the difference between forward and redirect. Can u plz help me to get information and working about collections in java from basics. If u have any materials for that, Plz send me to my mail ID mentioned here. Please do helpfull. Thanks in advance..

  323. pradeep

    nice example!! thanksss :-)

  324. abhishek

    mast………but i m expecting one example program for forward and request….

  325. Sathish Kumar Mani

    Your examples are awesome. I liked it no no I admired it

  326. Deepika

    its very awesome answers. by this answers i qualified google’s interview. thank you so muchl

  327. Deepika

    its very awesome answers. by this answers i qualified google’s interview. thank you so much.

  328. vijay

    hi…very nice..really your every post is useful…thanks.

  329. ramesh

    I think we also can switch from one domain to other by using Context level RequestDispatchers forward() method.

    Let me correct if I wrong!!!!

  330. sasi

    Really thanks , its very helpful for beginners..excellent definition and example

  331. Anonymous

    I am really happy with your simple for forward and sendredirect

  332. Peerbasha

    I am really happy with your simple for forward and sendredirect

  333. vishal biradar

    simply great….

  334. SasikumarDuraisamy

    Thanking y sir,you are very good Teacher…

  335. Yash

    Joe.. You have explained it very well..

  336. Dharmendra

    Really a very good explanation..with real world and practical scenarios.

    Thanks!

  337. Amit

    It really gives a clear concept….without the real world implementation it really becomes confusing

  338. Anonymous

    nice explanation..

  339. Anonymous

    thank you verymuch…it was really helpful to understand the concept.

  340. suranjan

    thank u again

  341. Anonymous

    examples plzzz

  342. sathya

    wonderful explanation

  343. Manoj

    Hello Joe,
    The example given to this topic is good. Many of them who do programming does not know which one to access because they have not been given the scenario examples. Even in my days of going to java course they didn`t think of giving the examples simply they said this is the syntax, you need to use like this. How can one understand when? where? how? why? to use the concepts of prgmming language. It is best desirable to give examples rather than teaching long hour periods. I think you have done a great job and if possible give examples like the said above to all the concepts blogged in this website.

  344. ramna

    1st time ever understand basic diffidence in two year java exp

  345. Naruto

    Nicely explained. Speaking of forwards and redirects, can you please explain the owasp top 10 security vulnerabilities? Its quite confusing for me to understand those in owasp or the others. I really look forward about you explaining about those ten!

  346. Mahima

    Thank you,finally i got the difference between redirect and forward

  347. Ravitheja

    Hi joe, example taken to explain this topic is fantastic… thank you, thanks a lot.

  348. Ahmad

    Really this a very good Blog

  349. Anonymous

    Excellent Explanation

  350. Bharath

    Very clear explanation. Thanks!!

  351. Prashant Agarwal

    Awesome Explanation !!!!!!!!!!!!

  352. Venky

    Awesome Example. Got clear information about sendRedirect() and forward() methods. Thanks alot :)

  353. Anonymous

    superbbbbb explanation…. thanks alottttt

  354. Manav

    Sir. you have definitely made our lives easy. Learning Java was never so enjoyable.

  355. Anonymous

    Hi Joe,
    Thanks for the explanation, I have a question. Other than session is there any way that we can transfer data across requests?

  356. Fine real world example. It was happen in my life.

  357. Manikantan

    Good Real world example :)

  358. keval

    very good and impressive example.

  359. shakti

    i think the forward example is little confused.according to the eg.. if u ll give the money to milkman that means the servlet-1 getting the result from servlet-2(Mother) and send d response to the request(milkman)….THIS IS THE EXMPL OR INCLUDE…THANK U.

  360. priyanka

    Awesome Example Joe

  361. Satheesh Kumar s

    SuberB!!!!! Real world example!!!! joe

  362. Anonymous

    Explained in best way.. Thank you.

  363. Dayanand

    superb Joe

  364. Anonymous

    Excellent Material.

  365. Anonymous

    very nice explanation and nice example

  366. Cheque Financial Loan: Most Best Way Of Possessing Money
    Thomas Alva Edison was born in Milan, Ohio in 1847.
    But, there is also a legend that he was born in Lagos de Moreno in Mexico and was taken to the United States as a toddler and adopted into the Edison loved ones.

    The legend, true or or else, testifies, at the very least, to the intercontinental
    veneration that this most prolific inventor enjoys until today.
    Who wouldn’t want to declare Edison as a indigenous son?
    Typically, an unexpected emergency problem like a damaged toilet would leave you pondering how you’re going to satisfy that invoice as nicely as all your other month to month outgoings.
    Unforeseen situations can make a big hole in your money reserves and the only preceding options had been high-priced, unauthorised overdrafts or credit history playing cards with superior
    month-to-month curiosity fees. Nevertheless, there
    is now a rapid, simple choice in the form of payday financial loans.
    A payday financial loan is a short-expression financial
    loan for a compact total -which functions as an progress on
    your regular every month or fortnightly pay back online loans.

    It really is an simple, hassle-no cost way to getting a bit of additional dollars promptly to bridge the gap concerning your speedy
    wants and your next pay back cheque.
    The IRS advises that you hold out at least seventy two hours right before examining on the standing of your
    refund if you filed electronically, and 4 weeks if you mailed in your return.

    So go forward and get your very own US Bank account now.
    Do not wait around till tomorrow as the legal guidelines are constantly switching.

    What is attainable now may not be achievable tomorrow.
    ACT fast. Good Luck.
    Some ladies might discover that ovulation does not return after they discontinue start command tablet use.
    If you do not encounter a menstrual interval in two to 3
    months after you have quit making use of the
    capsule, the American Being pregnant Affiliation recommends that you just take a being pregnant take a look at and speak to
    your health care provider. Having said that, it is crucial to preserve
    in intellect that the reason that ovulation does not return is
    usually unrelated to the tablet.
    Small business bills incurred up to seven decades prior to trading
    really commencing can be deducted from small business turnover if these fees
    had been solely for the upcoming business reasons.
    Enter such expenses in your accounting data as if they had been incurred on the initially working day of investing but clearly show the true acquire day.

    Lastly, even though it may perhaps be feasible to do all of
    this yourself, for your possess sanity and peace of head, you should really uncover a highly regarded and suitably qualified independent
    adviser. One who can offer you you suggestions that will be pertinent to you, your possess circumstance and necessities as effectively as chat
    points through with you your household and your other advisers (solicitors, accountants etc) where relevant.

    On the brick provider internet site, you will locate some specific gives.
    Just one of the distinctive features is receiving “cheap Bricks”.

    Low-priced bricks incorporate previous stock bricksthese are
    of superior excellent but have been in the manufacturer’s stock for a extended time, hence the packaging could be little soiled. An additional type of low-priced bricks is discontinued bricks where by some stock of the bricks is obtainable whose output has stopped.
    Claim business expenditures incurred prior to trading. Edison moved to New York Town when he was 20-two several years previous.

  367. Anonymous

    super example

  368. Lokesh Guru

    Good and easy example. Keep doing good work

  369. Nithin J Pathalil

    Just wish to tell u that the real world example was great.. Got the idea from the example.

  370. Anonymous

    examples gives brief idea.
    Thanks

  371. Rajasekhar

    Nice explanation and awesome example ha ha ha..

  372. Rajasekhar

    Nice explanation..

  373. Somu Sundara Goutham

    Good…Explanation…

  374. swagatika panda

    The example given was too nice.I got a clear idea on the topic.
    thnks…

  375. Anonymous

    worst

  376. Asanka

    Great article..! Keep it up

  377. Anonymous

    Fantastic very good real time example..

  378. Anonymous

    thanks, nice explanation

  379. Tushar

    Nice explanation …… Thanks :)

  380. Anonymous

    awesome style to explain this scenario,

  381. Vishal Desai

    nice explanation

  382. narayana

    Nice Eamples.

  383. Anonymous

    Nice Exxplanation!! . Thanks

  384. D N Ashok

    Hi….Joe….!

    A very good clarification….

    Thanx.

  385. Surendra

    Useful information… Thanks Joe.
    Your way of explanation is simply superb.

  386. Anonymous

    super bro..!!

  387. Anonymous

    Gr8 work..Thanks for ur article..

  388. Anonymous

    explanation is given by one tech lead …..
    hehehehe now i got it….

  389. S

    Very good example

  390. Aditya

    Hi Joe,

    Really, you had posted a Excellent topic
    The touchy part of the article was the Milk Man example.

    Thanks a Lot for your Effort.

    Adi

  391. abdulrahim

    i like real world example .

  392. sachin

    I like your examples joe….

  393. Vel SR

    Thanking you. Your my best java teacher..

  394. suresh

    thank u joe……..

  395. Adrita Ghosh

    I searched for this in many websites but the explanation given here is awesome. In simple words,described the best.Thanks a lot Joe sir.:)

  396. sam

    Nice Answer in simple word

    thanks….

  397. Jackin

    Excellent example too good

  398. Hemanth

    very good Explanation
    thank you

  399. Manju

    seriously great example……

  400. Ajay

    Excellent way of explaining it!

  401. Ashish

    Excellent work and excellent way of teaching by example.
    Thanks Joe

  402. Anonymous

    thank u

  403. Anonymous

    awsome..speechless….

  404. Vishwas

    Simply superbhhhh…..What an example !!!!!

  405. Anonymous

    For example, if i pay electricity bill in online, i have to pay the money through netbanking, can we say it is happening through redirect, then how the bill amount is getting displayed in netbanking site without a response/request.

  406. Devendra

    No doubt you are doing revolutionary work.
    Here I would like to suggest to you. Include practical examples with your theoretical explanation that make it absolute.

  407. Dilip Senapati

    Excellent. Well explained.

  408. Anonymous

    Than you very much…….

  409. Pavle

    Excellent example!

  410. Ana

    Example made my redirects and forwards solid..

  411. Anonymous

    Thanx.The way of explaination is superb!! through good example.

  412. Pawel

    Good job Joe!

  413. Anonymous

    Great Explination Joe.
    Appreciate your work.

  414. Yogesh

    Excellent example very well understand.Thanks sir

  415. Zulfikar

    Best explanation with example

  416. Ashwini Kumar Patro

    Sir,
    i want to know which one is faster in execution forward() or redirect ()?

  417. Binh Thanh Nguyen

    Thanks, nice post

  418. Anonymous

    I like your real world example. Thanks for sharing informatiiion

  419. Rashmi

    Thanks joy ….very clear example …easy to understand

  420. sapphire

    Great stuff

  421. Anonymous

    Very good example

  422. Satya Neeli

    Nice Example!!!

Your Comment