You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Byron <by...@nashfinch.com> on 2007/03/15 04:27:02 UTC

Duplicate validators on component bound to session bean

I am using myfaces 1.1.5 and am seeing something I could use some help in
understanding.

I have JSP that contains an input text field which is bound to a session
scoped backing bean.  This input field has a single validator that checks to
make sure the input is a number.  The first time I reach the page and put in
some bad input, a single message is displayed by the validator telling me
that my input is bad.  Great, everything is fine.  Then, if I go to another
page and come back and enter some bad input again, I receive two error
messages.  Each time I leave the page and come back results in an extra copy
of the message when I enter bad input.

I have been able to determine that it is not actually the message getting
duplicated, but instead an extra validator is getting added to the component
each and every time I come to this page.

Now, if I change the binding to point to a dummy request-scoped backing
bean, everything works fine -- never a duplicate validator.  Obviously what
is going on is that the faces runtime is adding the validator to the
component each time the page is entered, and when my component is bound in
the session, it is reused again and again, and as a result gets n copies of
the validator added to it.

My question is: why is the JSF runtime adding an extra copy of the validator
to my input component every single time I enter the page?  I know the JSF
spec says that binding should really only be done to request scoped data
when multithreaded concerns are involved, but that doesn't really seem
relevant to what's at play here.  I am only running one user and one thread.

So, is this a bug in the JSF implementation, or is there something I need to
do to my component when it's bound to a session backing bean to fix this? 
Any ideas are appreciated!  Thanks
-- 
View this message in context: http://www.nabble.com/Duplicate-validators-on-component-bound-to-session-bean-tf3406196.html#a9487964
Sent from the MyFaces - Users mailing list archive at Nabble.com.