Java 在bootsfaces中重置仅加载的表单值

Java 在bootsfaces中重置仅加载的表单值,java,reset,bootsfaces,Java,Reset,Bootsfaces,我需要重置表单字段并清除表单值onload。 但是我用- public void refresh() { FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); ViewHandler viewHandler = application.getViewHandler(); UIViewRoot

我需要重置表单字段并清除表单值onload。 但是我用-

    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和重复字段中输入值时,刷新功能不起作用。
我只是bootsfaces的初学者。请向我推荐一种方法。提前谢谢。

有一些方法可以清除表单的输入字段。例如,JSF2.2具有
resetValues=“true”
属性(请参阅(可能不是由BootsFaces实现的)。另一个选项是使用


但我想知道为什么要在客户端重置这些值?您必须清除它们,因为它们显示一些“脏”(即已修改)后端bean.IMHO更好的方法是创建一个新的、空的后端bean。

谢谢……但是你能以编程的方式解释一下如何在重置时清空bean中的值吗?你已经有了一个
刷新
方法,对吗?我只需手动将bean的每个属性设置为null,或者如果属性不是原始数据类型。顺便说一句,使用这种方法,您必须删除
type=“reset”
位。它阻止调用bean方法。