我在XHTML中有<p:calendar>
代码
<p:calendar
value="#{Bean.targetdate}"
pattern="MM/dd/yyyy" size="10" navigator="true"
rendered="#{Bean.editCmdActionflg == true}"
onblur="fChkDate(this);">
<f:convertDateTime type="date" pattern="MM/dd/yyyy" />
我的问题是当我提供无效日期,例如12/31/6666
<p:calendar>
接受日期,我在支持bean中做了SOP,我得到Mon Dec 31 00:00:00 IST 6666
日期我进入了。
我不应该允许用户输入无效日期,就像我在上面输入的日期一样。
我需要确保用户应该提供有效的日期。我该怎么做?
答案 0 :(得分:0)
您可以使用yearRange属性来解决您的问题,例如 -
<p:calendar yearRange="c-125:c+50" value="#{Bean.targetdate}" pattern="MM/dd/yyyy" readonlyInput="true" size="10" navigator="true"
rendered="#{Bean.editCmdActionflg == true}"
onblur="fChkDate(this);"/>