Object passed through jsp: param throws javax.el.PropertyNotFoundException: property 'foo' not found by type java.lang.String

I know this might be a stupid question, and I tried googling, but didn't get the perfect answer.

I am using the following code

<c:forEach var="aggregatedBatchProgressMetrics" items="${batchProgressMetricsList}">  
    <jsp:include page="html/tableContentsDisplayer.jsp">  
        <jsp:param name="batchProgressMetrics" value="${aggregatedBatchProgressMetrics}" />
    </jsp:include>
</c:forEach>  

and inside html / tableContentsDisplayer.jsp, I have the following

<c:set var="aggregatedBatchProgressMetrics">${param.batchProgressMetrics}</c:set>    
    <tr>  
        <td class="tdcenter">${aggregatedBatchProgressMetrics["clientId"]}</td>    
        <td class="tdcenter">${aggregatedBatchProgressMetrics["instrumentStats"]["totalImntsCompleted"]}</td>  
        <td class="tdcenter">${aggregatedBatchProgressMetrics["instrumentStats"]["totalImntsRemaining"]}</td>
    </tr>  

aggregatedBatchProgressMetrics is what I get from c: forEach is an object of type com.xyz.AggregatedBatchProgressMetrics, not a String, from the exception that it treats as a String object. I have a getClientId method inside a bean. Also, if I place the contents of the included jsp file as it is (without directives and c: set tag), it works absolutely fine. Is there a way I can pass an object using jsp: param tag, and on the resulting end I get it as an object?

, jstl i, / ?

,

+3
1

HTTP . jsp:param String#valueOf(). <c:set>.

<c:forEach var="aggregatedBatchProgressMetrics" items="${batchProgressMetricsList}">  
    <c:set var="batchProgressMetrics" value="${aggregatedBatchProgressMetrics}" scope="request" />
    <jsp:include page="html/tableContentsDisplayer.jsp" />  
</c:forEach>

<tr>  
    <td class="tdcenter">${batchProgressMetrics["clientId"]}</td>    
    <td class="tdcenter">${batchProgressMetrics["instrumentStats"]["totalImntsCompleted"]}</td>  
    <td class="tdcenter">${batchProgressMetrics["instrumentStats"]["totalImntsRemaining"]}</td>
</tr>  
+6

Source: https://habr.com/ru/post/1779365/


All Articles