thank you for your answer. The doc you'are referring to, does not describe how I can pass parameters back from a custom submit action to the redirection page.. Flow chart from https://helpx.adobe.com/aem-forms/6-1/custom-submit-action-form.html
In your custom submit action, you yourself can redirect to Thank You page after your submission workflow is completed. You can get url for thank you page from ":redirect" parameter from the request.
I've already tried this by writing a custom URL to the reponse's location attribute in the header.
response.setStatus(302); response.setHeader("Location", <custom redirect url>);
But setting the header in the custom submit action throws an IllegalStateException. Maybe the exception is thrown because the GuideSubmitServlet has already started to write to the response before my custom submit action is called.
Is there another possibility to set the redirect location?
From the documentation
If the action doesn't provide a forward path, the Submit servlet redirects the browser using the Redirect URL. The author configures the Redirect URL using the Thank You Page configuration in the Adaptive Form Edit dialog. You can also configure the Redirect URL through the Submit action or the setRedirectUrl API in the Guide Submit servlet. You can also configure the Request parameters sent to the Redirect URL using the setRedirectParameters API in the Guide Submit servlet.
We have a public API but seems like its missed in the documentation. To set the redirect url and parameters you can use the following APIs.
com.adobe.aemds.guide.servlet.GuideSubmitServlet public static void setRedirectUrl(final SlingHttpServletRequest req, final String redirectUrl) public static void setRedirectParameters(SlingHttpServletRequest request, Map<String, String> value)
with the help of your answer and the answer from Mandeep (http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/aem-forms.top ic.html/forum__yc8y-_hi_i_want_to.html) I could eventually pass a custom parameter to the redirect page :)
I'm using this dependency (in the bundle's pom.xml) to have the GuideSubmitServlet available in my custom submit action:
<dependency> <groupId>com.adobe.aemfd</groupId> <artifactId>aemfd-client-sdk</artifactId> <version>6.1.0</version> <scope>provided</scope> </dependency>
and I'm using this code in the submit action to add a custom parameter to the url of the redirect page:
Map<String, String> redirectParameters = GuideSubmitServlet.getRedirectParameters(request); redirectParameters.put("answerToTheUltimateQuestion","42"); GuideSubmitServlet.setRedirectParameters(request,redirectParameters);
Thanks a lot four your help,