【发布时间】:2010-09-15 21:10:20
【问题描述】:
我正在尝试使用 JSP 动态生成内容。
我有一个<c:forEach> 循环,我在其中动态创建bean 访问器。骨架类似于这样:
<c:forEach var="type" items="${bean.positionTypes}">
${bean.table} // append 'type' to the "table" property
</c:forEach>
我的问题是:我想根据类型更改${bean.table}。例如,如果类型是{"Janitor", "Chef},我想产生:
${bean.tableJanitor}
${bean.tableChef}
我怎样才能做到这一点?
【问题讨论】: