jsfprimefacesrequestcontext

RequestContext sends response but the page doesn't change


I have a JSF page, with some components rendered if a certain value is selected in SelectOneMenu. For that I change their rendered value and call RequestContext.getCurrentInstance().update("@form").

From the client point of view, whenever I select the value, I get a response from server:

<update id="mainForm:addUser:menu_14:menu">
<...some updated values...>
</update>

Yet, the element with id mainForm:addUser:menu_14:menu did not update.

Can anybody tell me what is wrong?

Update I can add commandButton with update="@form", and pressing this button actually redraws the form as needed. But I need to do this from the backing bean, so...


Solution

  • From the docs:

    public abstract void update(String name)

    Update a component with ajax.

    name - Client side identifier of the component.

    So you can't use selectors like you do from the xhtml file, you have to give client ID of the component.

    RequestContext.getCurrentInstance().update("mainForm")