I am calling a java class implementing WCMUse in template's(page component's) sightly (.html) where I am checking something and based on that I need to forward to some other cq page. The issue I am facing here is that the content of the current page remains intact and on top of it, the content of the page to which i want to forward to is being rendered. So I see the forward page and below that I see the header footer content etc again of the current page from where I am forwarding. Ideal behaviour that I need here is like only the content of the page where we are forwarding should come and current page's content should not appear. Java code snippet written in
slingRequest.getRequestDispatcher(pathofthepagetoforward).forward(slingRequest, slingResponse);
Please suggest any solution or may be I am doing something wrong here according to AEM.
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks for responses. Just posting my solution that worked. Actually it had nothing to do with the RequestDispatcher. The issue was because of misplaced redirection call. after rendering the current page's header section I was redirecting so the other page that was coming in response was also having the header section so that is why I was seeing two head sections and contents from two pages. I moved the redirection call to the beginning i.e. before rendering of anything. That way it worked fine.
Views
Replies
Total Likes
Are there any inheritance from parent page? Please check how you defined your page what components are included in the template
Views
Replies
Total Likes
Thanks for responses. Just posting my solution that worked. Actually it had nothing to do with the RequestDispatcher. The issue was because of misplaced redirection call. after rendering the current page's header section I was redirecting so the other page that was coming in response was also having the header section so that is why I was seeing two head sections and contents from two pages. I moved the redirection call to the beginning i.e. before rendering of anything. That way it worked fine.
Views
Replies
Total Likes
@__96 - I also need to implement the same use case in my project.So can you please share the solution with the code snippet or any example.It will help me alot.
Views
Replies
Total Likes
Views
Likes
Replies