0
Java class:
class start {
     Map<Integer, node> main;
}

class node {
    String a;
    Map<Integer, node> d;
}

"main": {
        "0": {
            "a": null,
            "d": {
                "0": {
                    "a": "ID1",
                    "d": {}
                },
                "1": {
                    "a": "ID2",
                    "d": {}
                }
            }
        }
    }

This is the JSON I am getting. There can be any number of nesting. It is like n array tree. I can able to print the first level. For printing the nested data I am recursively calling the same JSP file by passing the parameter d. But when I am trying to print the value of a (this is of main->0->d->0->a) the value is not printed on screen. Can anyone help me with this. Thanks in advance.

<c:forEach var="data" items="${main}">
    <jsp:include page="second.jsp">
        <jsp:param name="d" value="${data.d}"/>
        <jsp:param name="a" value="${data.a}"/> 
    </jsp:include>
</c:forEach>

In second.jsp
<c:set var="d" value="${param.d}"/>
<c:set var="a" value="${param.a}"/>
<c:out value="${a}">
<c:forEach var="data" items="${d}">
    <jsp:include page="second.jsp">
<%-- This below line is not printing on the screen. data is accessible but can not access data.d --%>
        <jsp:param name="d" value="${data.d}"/> 
        <jsp:param name="a" value="${data.a}"/> 
    </jsp:include>
</c:forEach>

0 Answers0