开发者

How to get a value of an object's property when the property name is a variable itself in JSP? [duplicate]

This question already has an answer here: How to get value of bean property when property name itself is a dynamic variable (1 answer) Closed 6 years ago.

HI,

Here's my dilemma. The below code is obviously wrong but it give you the idea on what I need to accomplish.

<c:forEach var="object1" items="${model.listofObjects1}"&开发者_如何学运维gt;
  <tr>
    <c:forEach var="object2" items="${model.listofObjects2}">
      <td>${object1.${object2}}</td>
    </c:forEach>
  </tr>
</c:forEach>

Any ideas on how to make this look up?


Use the brace notation.

<td>${object1[object2]}</td>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜