0
votes

After performing some validation in a Sling Servlet, I want to redirect to a 'Thank you' page, but it is not working — I can't access the request object.

We are doing it this way:

RequestDispatcher dispatcher = slingRequest.getRequestDispatcher("/content/project/abc/us/en/homepage.html", options);
dispatcher.forward(wrappedRequest, slingResponse);

We also cannot get the request object in the next page if we use sendRedirect() instead.

1
Please define "not working". Do you get an error message? Can you show the stack trace?David Levesque
It means when I'm trying to get the request parameters in the redirected page(homepage.html), I cannot get the parameters.OmP
@OmP In the question you've said you can't get the request, but in the comment above, you mention that you can't get the parameters — could you clarify which one it is? Also, as per David's comment, if you could give the error message that you're seeing too.anotherdave
Why not set the value you want to redirect in a request or session scope? and use it in the thank you page, alternatively you may also set the parameter value in crx i.e. jcr and simply redirect to thank you page there you may access the value from crx.yash ahuja
This is fixed now. Thanks guys. We used sessionStorage/localStorage for this.OmP

1 Answers

0
votes

This is fixed now. Thanks guys. We used sessionStorage/localStorage for this.