


Hi
I was just analyzing normal form handling from CQ(without using CQ form) and I got stuck in between. I have a form which I am submitting to a servlet through POST. After processing i want the form to redirect to the same jsp. I am not able to figure out how to achieve this. Any help would be appreciated
Thanks
Veena
Views
Replies
Sign in to like this content
Total Likes
Hi, there are probably a few ways of doing this. Here's two:
1) response.sendRedirect(req.getHeader("referer"));
This makes use of the referer header which may or may not be there, so it's not reliable all the time.
2) Have the form pass the page it's on as an variable and then use that for redirecting.
This of course could be a security risk so you need to check that the url submitted from the form to your servlet actually is residing on your page 🙂
Good Luck
/johan
Views
Replies
Sign in to like this content
Total Likes
You want to submit data to a CQ Sling Servet, process the data using the Sling Servlet (ie - encode it), and then return the data back to the JSP. We have several community articles on how to do this.
See:
http://scottsdigitalcommunity.blogspot.ca/2013/06/posting-form-data-to-adobe-cq-using.html
This walks your though how to do this. As an example of processing the data -- the data is encoded as JSON using the servlet.
Views
Replies
Sign in to like this content
Total Likes
Hi, there are probably a few ways of doing this. Here's two:
1) response.sendRedirect(req.getHeader("referer"));
This makes use of the referer header which may or may not be there, so it's not reliable all the time.
2) Have the form pass the page it's on as an variable and then use that for redirecting.
This of course could be a security risk so you need to check that the url submitted from the form to your servlet actually is residing on your page 🙂
Good Luck
/johan
Views
Replies
Sign in to like this content
Total Likes