我有一個f:loadBundle,它從我的類路徑中加載一個屬性文件。javax.el.PropertyNotFoundException while using f:loadBundle ...這是否正確實現了規範?
<f:loadBundle basename="com.xxx.ui.messages" var="msg" />
後來,我嘗試從資源包使用消息的語法如下:
<h:outputText value="test message: #{msg.does_not_exist} --"/>
它曾經是,JSF會打印出「未找到」的消息,但現在它拋出一個異常。規範是否改變或者這是正確的行爲?
我使用Mojarra 2.1.9和JUEL 2.2.4作爲EL解析器。這裏的堆棧跟蹤:
javax.el.PropertyNotFoundException: /WEB-INF/xxx.xhtml @10,70 value="test message: #{msg.does_not_exist} --": Property 'does_not_exist' not found on type java.util.PropertyResourceBundle
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:169)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
編輯: 正確的行爲都可以在這裏進行驗證:http://javaserverfaces.java.net/nonav/docs/2.0/vdldocs/facelets/f/loadBundle.html
(它說文字字符串??? ??? KEY從地圖,其中主要是返回即使除去JUEL
您之前是否使用過不同的JSF實現? 「回報垃圾」總是愚蠢的行爲,我懷疑這是什麼指定。 – millimoose
我相當肯定這是正確的行爲......無論好壞。看到這裏:http://stackoverflow.com/questions/6451215/jsf-how-to-remove-the-surrounding-if-message-not-found-in-messagebundle –
驗證,???不存在 ??應根據這裏的文檔返回:http://javaserverfaces.java.net/nonav/docs/2.0/vdldocs/facelets/f/loadBundle.html –