Hi, you should find that if you take the f:event tag outside the f:metadata tags that the listener
fires only once. From experimentation it seems that only f:viewParam tags should be nested
I've found this confusing myself because various JSF books contain examples showing f:event
If you're using templates JSF should be stripping everything outside of the ui:composition tags,
so I'd not expect your f:event tag to be processed. Here is a code extract from my template and
a content page, this is how I think it should work, note that I explicitly include an f:view tag...
--- template.xhtml ---
--- content.xhtml ---
If you've got this working with f:event outside of the ui:composition tag in a content page then I'd
say that this is almost certainly because of a bug in the implementation, rather than how it should
be done, but if it works for you who am I to argue!
From Core JSF 3rd Ed (Geary/Hortsmann) p184: "Facelets removes all tags outside the ui:composition
tag, that is the doctype declaration, html, head, title and body tags. This is necessary because the
ui:composition is replaced with the template that contains its own set of ... tags".
I perhaps confusingly name the section in my content file (defined by ui:define) metadata although
it contains f:event which is outside f:metadata.
You're absolutely right in what you wrote on your last post. I wrongly mentioned the <ui:composition> tag, when I wanted to refer the <ui:define>.
The solution was moving the <f:metadata><f:event ...></f:metadata> outside the <ui:define> tag.
My mistake, sorry.
It might just be luck if it's working. It's fragile. Not putting it inside f:metadata might cause the listener method to not be called at some other point and you start wondering what broke. Don't do it!
If you're experiencing redundant calls to the preRenderView method, you have to resort to Seam 3 Faces' s:viewAction instead: