ValueChangeListener and RenderResponse

Hello all,

I made the following experiment:

I created two JSF pages.

On page 1 I have only one commandLink, withactionListener with the following code:

bean.setProperty("2006");

On page 2 we have only a SelectOneMenu that is bound to the backing bean property #{bean.property}. The selectOneMenu has selectItems bound to a list of "SelectItem"s, representing years (2001, 2002, ... 2006, 2007...)

Additionally, the selectOneMenu has onchange="submit();" javascript attached and immediate = true". Finally, it has a ValueChangeListener attached which does only this:

FacesContext context = FacesContext.getCurrentInstance();

context.renderResponse();

So I do this thing:

1. Open page 1

2. Navigate to page 2 (the actionListener is called)

3. Change the value in the selectOneMenu to 2007 (the ValueChangeListener is called)

4. Navigate back to page 1.

5. Navigate to page 2 (the actionListener is called)

=> The selectOneMenu still has2007selected.

As it can be seen, the ValueChangeListener is NOT called anywhere after step 3. However, if I remove the context.renderResponse() method from the ValueChangeListener and repeat those 5 steps, the selectOneMenu after step 5 has2006selected (so everything is OK).

Do you have any idea why this method RenderResponse called only in step 3 affects the behaviour of the application later?

Best Regards,

Slavi

[1527 byte] By [slavi.marinova] at [2007-10-2 18:42:25]
# 1
Do you have the bean on request scope?
pringia at 2007-7-13 20:04:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...