【发布时间】:2013-07-14 12:32:44
【问题描述】:
我想让<p:calendar> 只读,这样用户就只能从日历中选择一个日期,因为this 问题(虽然这不是解决方案)。
为此,我正在做readonly="#{facesContext.renderResponse}" 所提到的this 回答喜欢,
<p:calendar id="calendarId"
value="#{bean.property}"
converter="#{jodaTimeConverter}"
pattern="dd-MMM-yyyy hh:mm:ss a"
showOn="button"
readonly="#{facesContext.renderResponse}"
effect="slideDown"
required="true"
showButtonPanel="true"
navigator="true"/>
这可行,但是当页面加载时(在地址栏中键入 URL,然后按 Enter 键),facesContext.renderResponse 返回false 并且日历不再是只读的。当我按下<p:commandButton> 提交表单时,它的计算结果为true。
那么,如何在页面加载时将日历设为只读?
P.S:我正在使用 PrimeFaces 3.5 和 Mojarra 2.1.9。
【问题讨论】:
标签: jsf jsf-2 primefaces