Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp SpringJSTL:如何访问对象迭代中的任意字段_Jsp_Jstl_El_Spring Roo - Fatal编程技术网

Jsp SpringJSTL:如何访问对象迭代中的任意字段

Jsp SpringJSTL:如何访问对象迭代中的任意字段,jsp,jstl,el,spring-roo,Jsp,Jstl,El,Spring Roo,我正在编写一个.tagx文件,希望在一个表中显示一个对象列表,其中包含用户选择的列 到这里时,我已经有了包含数据库对象列表的${items},以及包含与${items}内容的字段名匹配的字段名列表的${columns} 我正在努力做到: <table> <c:forEach var="item" items="${items}" > <tr> <c:forEach var="column" items="${columns}"&g

我正在编写一个.tagx文件,希望在一个表中显示一个对象列表,其中包含用户选择的列

到这里时,我已经有了包含数据库对象列表的
${items}
,以及包含与
${items}
内容的字段名匹配的字段名列表的
${columns}

我正在努力做到:

<table>
  <c:forEach var="item" items="${items}" >
    <tr>
      <c:forEach var="column" items="${columns}">
        <td><!-- What should go here? --></td>
      </c:forEach>
    </tr>
  </c:forEach>
</table>

${item.column}
向我投诉item没有名为
column
的字段。这是真的

放置
${item.${column}}
时出现语法错误(无效字符“{”)


正确地放置“ASDF”表明列的布局良好,并在其中放置了虚拟数据。因此,除了访问我们正在迭代的项的任意字段之外,它实际上就是一切。

使用
${item[column]}
。不要忘记使用
正确地进行HTML转义