The following code is written by me while comparing the difference in the behavior of redirect and forward:
MyPage.jsp is as follows:
and page2.jsp is as follows:
and i found the result:
Page 2 JSP
This is the forwarded page. null
which means that when we redirect a request to another page, the request attributes are not accessible from the redirected page. I am not sure whether I am correct or not , or am I making some mistake with the coding??
Now if I change my MyPage.jsp as follows:
now the result is :
Page 2 JSP
This is the forwarded page. saimakanwal
it means that if we forward a request , it retains all the request attributes. Am I correct with this conclusion or not? or am i making some mistake with the coding . Anyone please confirm and clarify.