<o:importFunctions type="java.lang.Math" />//omnifaces, see http://showcase.omnifaces.org/taghandlers/importFunctions
<c:set var="ordersToShow" value="${Math:min(5, processedOrders.size())}" /> // processedOrders is a List
<p:fieldset legend="Last Stuff (${ordersToShow})">[...]</p:fieldset>
$ {ordersToShow}的类型为java.lang.Double(输出为“$ {ordersToShow.class}”)并打印某物。如“Last Stuff 2.0”。在内联文本中将double转换为int
我想要输出“Last Stuff 2”,我该怎么做?
为什么它首先是double而不是整数?如何让代表“数量”的字段具有双重类型?你的根本问题是错误的数据模型,而不是麻烦的表述。 – BalusC 2013-04-08 13:52:50
你是对的,正确的dataModel我不会有这个问题。我更新了问题以更好地解释我的问题。如您所见,我无法更改数据模型,因为在模板中创建了“ordersToShow”。感谢您的omnifaces :: importFunctions。真是奇怪,Math:min似乎为(int,int)输入返回一个double。无论如何,国际海事组织应该这样做,''cast'to jsf-template int'无论如何都是可能的。 – 2013-04-08 14:51:17