JSF commandButton with immediate=“true”

后端 未结 3 634
无人及你
无人及你 2021-01-05 17:03

I have a situation where there is a selectOneMenu that has a value bound to a backing bean.

I need to have a button that doesn\'t update model values (that is why it

3条回答
  •  鱼传尺愫
    2021-01-05 17:56

    To follow up a bit, I don't think you need to bind the component to a bean. You can just grab the component from the FacesContext instance via the UIViewRoot, if you know the component's client ID.

    It would go a little something like this:

    Foo component = (Foo)FacesContext.getCurrentInstance().getViewRoot().getComponent(clientId);
    

    Where Foo is the class of the component you are using and clientId is the client ID of the component in the "formId:elementId" format that JSF uses.

提交回复
热议问题