You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Component Events

Why does Tapestry send a redirect after a form is submitted?

This is an extension of the redirect after post approach. It ensures that after an operation that updates server-side state, such as a form submission, if the user resubmits the resulting page, the operation is not performed a second time; instead just the results of the operation, reflecting the changed server-side state, is re-rendered.

This has the unwanted requirement that any data needed to render the response must persist between the event request (the form submission) and the render request; this often means that fields must be annotated with @Persist.

Added in 5.2
If you want to short-circuit this behavior and render a response directly, your component event handle method may return an instance of StreamPageContent. Tapestry will render the page as part of the event request and stream its content back to the client web browser, rather than sending the normal redirect.
  • No labels