升级到JSF Mojarra 2.2.5后,使用Omnifaces的el函数formatNumber时出现以下异常。这仅发生在复合组件中。 Normal Facelet工作正常。
javax.el.ELException:找不到函数':formatNumber'
这是我的复合组件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:of="http://omnifaces.org/functions">
<cc:interface>
<cc:attribute name="cart" required="true" type="org.ead.eeb.order.ShoppingCart" />
<cc:attribute name="allowCouponRemove" required="true" type="java.lang.Boolean" />
<cc:attribute name="removeCouponBean" type="java.lang.Object" />
<cc:attribute name="removeCouponAction" type="java.lang.String" />
<cc:attribute name="removeCouponProperty" type="java.lang.String" />
</cc:interface>
<cc:implementation>
<h4>Übersicht</h4>
<table class="table">
<tbody>
<c:forEach items="#{cc.attrs.cart.items}" var="item">
<tr>
<td><abbr title="#{item.description}">#{item.name}</abbr></td>
<td class="text-right">#{of:formatNumber(item.totalAmount, '#0.00')} €</td>
</tr>
</c:forEach>
<tr>
<td>Mehrwertsteuer (#{cc.attrs.cart.taxRatePercentage} %)</td>
<td class="text-right">#{of:formatNumber(cc.attrs.cart.totalTax, '#0.00')} €</td>
</tr>
</tbody>
<tfoot>
<tr class="active">
<td><strong>Gesamtbetrag</strong></td>
<td class="text-right"><strong>#{of:formatNumber(cc.attrs.cart.totalOrderAmount, '#0.00')} €</strong></td>
</tr>
</tfoot>
</table>
...
</cc:implementation>
事先感谢您的帮助:)
修改
如果我使用cc.attrs.*
中的值,则会出现问题。如果我直接使用该值作为属性,那么everthing效果很好。有什么想法吗?
EDIT2: 可通过以下代码
进行解决方法<c:set var="test" value="#{cc.attrs.value}" />
#{of:formatNumber(test, '#0.00')}
但那很难看。我找不到我的错误。
答案 0 :(得分:1)
我创建的问题被标记为“不要修复”,因为有一种解决方法:
使用#{foo}
替换<h:outputText value="#{foo}"/>
类型的所有便捷内联电话。
https://java.net/jira/browse/JAVASERVERFACES-3469
非常不方便且麻烦。来自2.2.4的许多回归 - &gt; 2.2.5。