Java icefaces选择输入日期值
我使用iceface的selectInputDate。.jspx文件中的代码如下所示:Java icefaces选择输入日期值,java,icefaces,jspx,selectinputdate,Java,Icefaces,Jspx,Selectinputdate,我使用iceface的selectInputDate。.jspx文件中的代码如下所示: <ice:selectInputDate id="Dt" value="#{actionsBean.MDate}" renderAsPopup="true" required="true" partialSubmit = "true" popupDateFormat="#{msgs.date_format}" value
<ice:selectInputDate id="Dt"
value="#{actionsBean.MDate}"
renderAsPopup="true" required="true"
partialSubmit = "true"
popupDateFormat="#{msgs.date_format}"
valueChangeListener = "#{actionsBean.mDateChangeListener}">
<f:converter converterId="MDateConverter" /> </ice:selectInputDate>
问题实际上是:我希望输入中的值默认为空字符串。我设置为MDate null值,然后面板打开,在用户(本例中为我)工作并关闭面板后,我再次将null值设置为MDate。但是,当我通过日历选择的最后一个值被保存并自动填充时,我再次打开面板。我如何解决这个问题?谢谢。您实际上可以用
f:ajax
监听器替换valuechangeelistener
,并尝试查看差异
<h:form id="dateForm">
....
<ice:selectInputDate id="Dt"
value="#{actionsBean.MDate}"
renderAsPopup="true" required="true"
partialSubmit = "true"
popupDateFormat="#{msgs.date_format}">
<f:converter converterId="MDateConverter" />
<f:ajax execute="@this" render="@form"
listener = "#{actionsBean.mDateChangeListener}">
</ice:selectInputDate>
...
</h:form>
....
...
这可能是由icefaces弹出面板的问题引起的,我尝试的是在每次关闭(隐藏)弹出面板时执行此代码:
这将重置弹出窗口的状态。关闭面板时,selectInputDate组件不会在页面上重新绘制,然后返回旧值。例如,如果使用“rendered=true/false”属性来显示/隐藏父面板,则可以使用该属性 要修复此问题,请使用“visibled”属性而不是“rendered”,或者直接在selectInputDate组件中使用绑定清除值
public void clearSubmittedValues() {
final FacesContext context = FacesContext.getCurrentInstance();
final Application application = context.getApplication();
final ViewHandler viewHandler = application.getViewHandler();
final UIViewRoot viewRoot = viewHandler.createView(context, context.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
}