Spring MVC Controller: what is the difference between "return forward", "return redirect" and "return jsp file"
The first question is: I am not sure about correctness this button. It works well, but I have question mark after press this button.
Ok, it's insert a question mark because you use GET http method. You need to use POST method to pass the data in the request payload.
return "redirect:/books";
It returns to the client (browser) which interprets the http response and automatically calls the redirect URL
return "jsp/books/booksList";
It process the JSP and send the HTML to the client
return "forward:/books";
It transfer the request and calls the URL direct in the server side.
To decide which one to use you have to consider some aspects of each approach:
Forward: is faster, the client browser is not involved, the browser displays the original URL, the request is transfered do the forwarded URL.
Redirect: is slower, the client browser is involved, the browser displays the redirected URL, it creates a new request to the redirected URL.