Skip to main content

Redirect After POST

Learn Redirect After POST (Form Handling, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Redirect after POST means that after a form POST succeeds, the controller returns redirect:/somewhere instead of rendering a view, so the browser makes a new GET request. Why : if the POST response is a page, pressing refresh re-sends the POST and can create a duplicate order or payment. Syntax : return the string "redirect:/orders/42" from the handler, and Spring sends an HTTP 302 with a Location header.

More lessons in Form Handling