It would be better to simplify the code and post snippets there. Sorry but also not sure that currently getting the problem clearly.
Thanks for your reply. I fixed my problem. Basically, I've conditionally added the pages that gave me trouble, inside a c:if tag. That ensured that I had the right objects on the right pages.