4
votes

Can I rerender a jsf ui component when a valuechangelistener method is run? The reason i'm asking is that my valuechangelistener method changes the values of the input boxes in the backing bean but they don't seem to be rerender. What happens eventually is that the values that are printed on screen are saved to the backing bean, overriding the values loaded through the valuechangelistener method.

The following doesn't work:

<h:inputText id="inputbox_id" value="#{name}"/>
<h:selectOneMenu valueChangeListener="#{myBean.changeCountryMenu}">
  <a4j:support event="onchange" rerender="inputbox_id" action="#{bean.test}>
</h:selectOneMenu>

Notice that bean.test() is never run. (UPDATE: It does, I had a renderResponse() that skipped it before. The values still do not reRender though) So the solution I thought of is to rerender the inputbox from the valueChangeListener. If there is some other better solution i'd be glad to hear...

Thank you! Ben.

1
This is not answer of question... Question is "Can I ReRender a JSF Component from backing bean code? " not "Can I reRender a JSF Component from jsf ?"baybora.oren
I guess that by "this" you refer to my answer. It doesn't answer the title, but it answers the problem described in the questionBozho

1 Answers

1
votes

The attribute name is reRender (with capital R the second time). Perhaps you have to add immediate="true" ?

Also, check this article