【发布时间】:2011-05-13 14:56:10
【问题描述】:
这就是我想要生成的:
<div class="marker" style="background:transparent url('/myApp/faces/javax.faces.resource/1.png?ln=images/map') no-repeat center top;"></div>
<div class="marker" style="background:transparent url('/myApp/faces/javax.faces.resource/2.png?ln=images/map') no-repeat center top;"></div>
<div class="marker" style="background:transparent url('/myApp/faces/javax.faces.resource/3.png?ln=images/map') no-repeat center top;"></div>
etc...
这是我的代码:
<ui:repeat value="#{myBean.items}" var="item" varStatus="status">
<h:panelGroup layout="block" styleClass="marker" style="background:transparent url(#{resource['images/map:'+(status.index+1)+'.png']} no-repeat center top;"/>
</ui:repeat>
这是因为 EL 解释器试图将“图像/地图”转换为数字而导致 NumberFormatException 失败。经过一番搜索,我发现 + 仅用于添加数字。任何想法如何达到预期的结果?
【问题讨论】: