Typically how an ATG form handler handles form submissions is that if the form submission has any errors it redirects to an error or failure URL, otherwise it redirects to the success URL. It does this when you call the form handler’s method checkFormRedirect
.
However by redirecting you are creating a new request and you will lose all the information in the current request. If you want to keep them you can do this by forward instead of redirecting.
To specify that a form handler use forward instead of redirect you can either
- set the request parameter “atg.formHandlerUseForwards” to “true” (case insensitive) OR
- set the boolean property useForwards to true, either in the properties file of the form handler or using a hidden input in the JSP/JHTML form
None of this as far as I can tell is documented, probably because instead of using forwards ATG would probably prefer developers make a form handler session scoped if information needs to be preserved over multiple requests. Regardless this is all documented in the source code for atg.droplet.GenericFormHandler which is available in the ATG install location under DAS/src/Java/.
Note that if you call the response’s method sendLocalRedirect
you bypass the flexibility of possibly using forwards. Instead it is preferable to call the form handler’s method redirectOrForward
.