The question is in the title. I got a Spring MVC Web App and I have to modify many things, I'm noob with this and before do anything I'm trying to understand how is made.
What's the difference between:
return new ModelAndView("redirect:surveys.hmtl");
and
return new ModelAndView("surveys.html");
Thanks.
The first one redirects:
POST or GET
browser -------------------------------------> spring controller
redirect to surveys.html (status = 302)
<------------------------------------
GET
-------------------------------------> surveys.html
final page
<-------------------------------------
The second one forwards:
POST or GET
browser -------------------------------------> spring controller
|
|
final page V
<------------------------------------- surveys.html
Redirect - sends a http 302 Redirect to the client. And then the client will send a new request to the server, with the given url.
while return new ModelAndView("surveys.html");
instruct spring to return this view to the client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With