In my controller I add to model dynamically called attributes, like:
model.addAttribute("message"+singleMessage.getId()+"comments", messageComments);
so in my jsp view I have collections like message1comments, message7comments, message457comments etc.
Now when I go through messages collection when I'm displaying a message with id let's say 19 I want to check if it has any comments by checking if such attribute/collection like "message19comments" exists.
Question is: how to do it? I don't know how to construct such a name and check if argument with this name exists. I tried:
<c:if test="${not empty "message"+message.id+"comments"}>
and some other things but to no avail. When I print
${requestScope}
I can see all those comment collections. But how do I check if the one with dynamically generated name exists?