升级到 JSF Mojarra 2.2.5 后,在使用 Omnifaces 的 el 函数 formatNumber 时出现以下异常。这仅发生在复合组件内。普通 Facelet 工作正常。
javax.el.ELException:找不到函数“of: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>
在此先感谢您的帮助 :)
Edit:如果我使用来自的值,就会出现问题cc.attrs.*
。如果我直接使用该值作为属性,则一切正常。有任何想法吗?
Edit2:可以通过以下代码解决方法
<c:set var="test" value="#{cc.attrs.value}" />
#{of:formatNumber(test, '#0.00')}
但这是相当难看的。我找不到我的错误。
我创建的问题被标记为“无法修复”,因为有解决方法:
替换所有方便的内联 el 调用类型#{foo}
with <h:outputText value="#{foo}"/>
.
https://java.net/jira/browse/JAVASERVERFACES-3469 https://java.net/jira/browse/JAVASERVERFACES-3469
非常不方便而且麻烦。 2.2.4 -> 2.2.5 的许多回归。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)