1
我需要重新設置表單域和清除表單值的onload。 不過我用 -復位形式值的onload在bootsfaces
public void refresh() {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ViewHandler viewHandler = application.getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, context
.getViewRoot().getViewId());
context.setViewRoot(viewRoot);
context.renderResponse(); //Optional
}
上面的代碼工作,但是當我在使用領域在panelGroup中輸入值,它不工作。
<h:panelGroup>
<ui:repeat value="#{formDynAttrbBean.vals}" var="values">
<b:panelGrid columns="6" cellspacing="4">
<b:inputText id="label" value="">
</b:inputText>
<b:selectOneMenu value="">
<f:selectItem itemLabel="SelectType" itemValue="" />
<f:selectItems value="" />
</b:selectOneMenu>
<b:selectBooleanCheckbox value="" />
<b:commandButton actionListener="#{form.types}" />
</b:panelGrid>
</ui:repeat>
<b:commandButton tooltip="Add new attribute" tooltip-position="bottom"
iconAwesome="plus" actionListener="#{form.add}" update="@form" />
<tr />
<b:commandButton value="Save" ajax="true"
actionListener="#{form.submit}" update="@form" />
<tr />
<b:commandButton type="reset" action="#{formController.refresh}"
value="Reset">
</b:commandButton>
</h:panelGroup>
刷新功能是不是在這種情況下工作時,我進入panelGroup中和重複字段的值。 我只是一個初學者boots boots。請告訴我一個方法。提前告訴我。
三江源....但是,你能給我們解釋程序如何在清空豆值復位? – Spandana
你已經有了一個'refresh'方法,對嗎?我只是Bean的每一個屬性手動設置爲空或對象的新實例,如果屬性不是原始數據類型。順便說一句,使用這種方法,你必須刪除'type =「reset」'位。它阻止了調用bean方法。 –