4

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.

2
  • 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 ?" Commented Jul 24, 2011 at 21:05
  • I guess that by "this" you refer to my answer. It doesn't answer the title, but it answers the problem described in the question Commented Jul 26, 2012 at 11:42

1 Answer 1

1

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

Also, check this article

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I've read the article by BalusC about jsf lifecycles and realized that my problem needed a better understanding of JSF lifecycles. (balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html)
then I'll at least add the link to my answer, so that there is a reason to be marked as accepted.
@downvoters - it's not my fault that the title of the question doesn't correspond to the question asked. I fixed the guy's problem ;)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.