在 JSF 中使用 JSTL 函数
我想使用 JSF2 中包含的 JSTL 函数 这是我尝试过的,但条件总是评估为 false,我想我错过了一些东西:
<c:forEach items="#{myBean.toSendCheckBoxes}" var="entry" varStatus="loop">
<input type="checkbox" name="myArray" value="#{entry.value}" />
<c:choose>
<c:when test="#{fn:contains(entry.key,'g')}">
<ice:graphicImage url="/resources/images/image1.bmp" />
<b>#{entry.key}</b>
</c:when>
<c:otherwise>
<ice:graphicImage url="/resources/images/image2.bmp" />
<span>#{entry.key}</span>
</c:otherwise>
</c:choose>
</c:forEach>
如果有另一种 JSF 方法可以实现这一点,那么非常高兴提及它,提前致谢。
i want to use the JSTL function contains in JSF2
here's what i tried but the condition always evaluates to false, i think i am missing something:
<c:forEach items="#{myBean.toSendCheckBoxes}" var="entry" varStatus="loop">
<input type="checkbox" name="myArray" value="#{entry.value}" />
<c:choose>
<c:when test="#{fn:contains(entry.key,'g')}">
<ice:graphicImage url="/resources/images/image1.bmp" />
<b>#{entry.key}</b>
</c:when>
<c:otherwise>
<ice:graphicImage url="/resources/images/image2.bmp" />
<span>#{entry.key}</span>
</c:otherwise>
</c:choose>
</c:forEach>
if there's another JSF way to accomplish that, would be very nice to mention it, thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更 JSFish 的方法是
或者甚至
,但我希望你的病情能够得到正确的评估。
More JSFish way to do it would be
or even
but I would expect your condition to evaluate properly nevertheless.
我使用
t:dataList
(myfaces tomahawkxmlns:t="http://myfaces.apache.org/tomahawk"
) 循环元素以生成正确的标识符,rendered
属性用于列表中元素的不同显示。我在
ui:repeat
中遇到动态元素渲染(显示/隐藏行)的问题,因此我不得不使用t:dataList
来代替。I use
t:dataList
(myfaces tomahawkxmlns:t="http://myfaces.apache.org/tomahawk"
) for looping over elements to have correct identifier generation andrendered
attribute for different displaying of elements in the list.I've had issues with dynamic element rendering (show/hide rows) within
ui:repeat
, so I had to uset:dataList
instead.