I'm having the following problem in my JSF web application:
I have a request scope backing bean. The first time this bean is loaded (I check
this with the ResponseStateManager.isPostBack() method) I fill a list of SelectItem instances that are to be displayed in the JSF page in a <h:selectOneMenu> component.
The list goes, of course, to the <h:selectOneMenu>'s <f:selectItems> facet child
component. In the constructor I also define the value that goes to the value property
of the <h:selectOneMenu> component. This value is a property in the backing bean, as
is the list of SelectItem instances. Until now we have something like this:
The backing bean declaration in faces-config.xml:
The relevant parts of the JSF page:
The relevant parts of the backing bean class:
But when the user submits the form and the bean constructor is called again
(this time the method ResponseStateManager.isPostBack() returns true),
in the else block in the constructor above, I need to fill fSetoresOrigem with
other values and also the fSetorOrigem field because, of course, the fSetorOrigem field has to be a valid value that exists in the new fSetoresOrigem list.
JSF is not complaining about the change to the list items, but it is complaining
to the change to the fSetorOrigem field (the list value), even though it is a
valid value present in the list. So I'm getting this error message:
I suppose that JSF is comparing the new value of the field fSetorOrigem with the value
it has in the view state. As the value is different it is raising the error. That's
what I suppose. But am I not able the change the value in the postback? I've already
checked and the value is valid. It corresponds to a value that exists in the list.
I really need a solution to this problem as I'm stuck with this and can't proceed until
I find a solution to this. What I am doing wrong and how can I solve this?
I also posted my question here because this is an important issue to me and I haven't got any answer from the other forum until now. I think that posting my question in more than one forum increases my change to get an answer. It's really not my intention to upset anyone with this. I just want a answer to my problem.
Marcos
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Validation error while trying to change a value in a request scope bean