我有一个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 –