webtier@glassfish.java.net

preRenderView event firing unexpectedly

From: <webtier_at_javadesktop.org>
Date: Wed, 28 Jul 2010 09:50:53 PDT

I've got a preRenderView listener firing in the middle of a page - any ideas why?

I've got this listener, I'm using templates and have tried inserting this code
before <head>, inside <head> </head> and in the body, no difference.

[code]
<f:metadata>
            <f:event type="preRenderView" listener="#{teamCreateView.setupPage}"/>
        </f:metadata>
[/code]

Then in the body I've got this:

[code]
<h:selectOneMenu id="sport" value="#{teamCreateView.team.sport}"
                                 converter="sportconverter"
                                 immediate="true"
                                 valueChangeListener="#{teamCreateView.enableInputClub}"
                                 styleClass="teamFormSelectMenu">
                    <f:selectItem itemLabel="#{msgs.selectOneLabel}" noSelectionOption="true"/>
                    <f:selectItems value="#{appView.sportList}"/>
                    <f:ajax/>
                </h:selectOneMenu>
[/code]

What I'm seeing is that as the page loads the preRenderView listener is called
3 times (why does JSF have to do this?), then I select a value from the "sport"
select box, the value change listener enableInputClub fires then I see the
setupPage preRenderView listener firing.

Surely this is not right? In the meantime I'll have to go back to using
@PostConstruct.

Regards,
Brendan.
[Message sent by forum member 'healeyb']

http://forums.java.net/jive/thread.jspa?messageID=478727