You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Neuman, Ben J., A&M IRM" <bj...@hq.afis.osd.mil> on 2006/04/24 16:15:31 UTC

Problem with Render Tab: false

Having a problem with <t:panelTabbedPane> rendering. I am trying to prohibit
the rendering of select tabs based on certain criteria but rendered='false'
tabs always display on initial page load. When I load the page a second
time, the tabs are not rendered (as intended).
 
  I have a <h:commandLink> that calls an action on a managed bean.
 
<h:commandLink action='#{managedBean.showTabs}'>
                    <h:outputText value='Go to tabs'/>   
</h:commandLink>  
 
//managed bean method....
public String showTabs() {
        return "mytabs";
}
 
Finally, I have a phase listener that wants to turn off rendering for
certain tabs:
 
   public PhaseId getPhaseId() {
        // I really have very little idea of the correct PhaseId to use
here. (newbie)
        return PhaseId.INVOKE_APPLICATION;
    }
 
    public void beforePhase(PhaseEvent phaseEvent) {
        prepareForResponse();
    }
 
    public void afterPhase(PhaseEvent phaseEvent) {
    }
 
    private void prepareForResponse() {
        if (today.equals("Monday") {
 
tabsComponent.findComponent("content:HappyDayTab").setRendered(false);
        }
    }    
    
So, it all seems to work the second time I click the commandLink. But the
HappyDayTab always shows up on initial click. What am I doing wrong here? I
imagine it has something to do with my iignorance of the render response
lifecycle. If not, is this a bug?
 
Thanks!
Ben

    

Re: Problem with Render Tab: false

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi Ben,

on initial request the application phase is skipped, so your phase
listener is not invoked.

Try on render phase e.g just change 'return PhaseId.INVOKE_APPLICATION'
to 'return PhaseId.RENDER_RESPONSE' in your listener.


Regards,
  Volker


Neuman, Ben J., A&M IRM wrote:
> 
> Having a problem with <t:panelTabbedPane> rendering. I am trying to
> prohibit the rendering of select tabs based on certain
> criteria but rendered='false' tabs always display on initial page load.
> When I load the page a second time, the tabs are not rendered (as
> intended).
>  
>   I have a <h:commandLink> that calls an action on a managed bean.
>  
> <h:commandLink action='#{managedBean.showTabs}'>
>                     <h:outputText value='Go to tabs'/>   
> </h:commandLink> 
>  
> //managed bean method....
> public String showTabs() {
>         return "mytabs";
> }
>  
> Finally, I have a phase listener that wants to turn off rendering for
> certain tabs:
>  
>    public PhaseId getPhaseId() {
>         // I really have very little idea of the correct PhaseId to use
> here. (newbie)
>         return PhaseId.INVOKE_APPLICATION;
>     }
>  
>     public void beforePhase(PhaseEvent phaseEvent) {
>         prepareForResponse();
>     }
>  
>     public void afterPhase(PhaseEvent phaseEvent) {
>     }
>  
>     private void prepareForResponse() {
>         if (today.equals("Monday") {
>            
> tabsComponent.findComponent("content:HappyDayTab").setRendered(false);
>         }
>     }    
>     
> So, it all seems to work the second time I click the commandLink. But
> the HappyDayTab always shows up on initial click. What am I doing wrong
> here? I imagine it has something to do with my iignorance of the render
> response lifecycle. If not, is this a bug?
>  
> Thanks!
> Ben
> 
>    

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.