I had much troubles with a (before render response) phaselistener registered to
my facelets view using the <f:phaselistener> tag. It was called multiple times
although registered only once. As I unsuccessfully spent hours to search on the
web for such an issue I started to debug the facelets view root and found out,
that whenever I submit the facelets view with invalid content (validation
fails) it jumps to the render response phase, but my phaselistener is suddenly
registered one more time. I.e. when I first view the facelets page my
phaselistener runs only once as it is only registered once in the view root.
When I then submit with invalid input and the validation fails, it goes to the
render reponse phase again and suddenly my phaselistener ist called twice (as
it is now registere 2 times in the view root). Whenever I repeat submitting
invalid values and validation fails, the registration count of my phaselistener
is incremented (i.e. 3 times after my 2nd attempt to submit invalid
values...and so on).
I do not think this is wanted, and also could not find any documentation about
this behaviour. To me it looks like a defect. Am I right?
Thank you, Rainer Podlas
(in the meantime I do not registere it for the view with the f:phaselistener
tag, but instead perform the lifecycle registration via config, but anyway it
would be great if it works properly via the tag)