MVC and request handling · Question 8 of 12

Why does a createAction() in Extbase usually redirect to another action with $this->redirect()?

1 answer is correct. Easy

Show answer

Answer

  • C So that reloading the page does not resubmit the form and create a duplicate record

Explanation

The pattern is called Post/Redirect/Get: redirect() sends an HTTP 303 "See Other" response, the browser discards the POST body and requests the target page via GET. If the visitor then presses F5 or the back button, only the GET request is repeated – not the form submission. Important: redirect() returns a response, so you must write return $this->redirect('list');. Flash messages also work without a redirect, but by default they are kept in the session so that they survive a redirect.

Certifications & exams

Which exam comes next?

You can already practise for 19 exams, and 21 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications