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方法。 –