You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Madhav Bhargava <Ma...@infosys.com> on 2006/12/13 13:15:57 UTC

Problems while programmatically adding components

Hi All,



I have a JSP which uses tiles.

The left menu part of the JSP needs to be programmatically created as
the left menu will differ based on the role the use plays.



In the leftNavigationMenu.jsp - included as a tile in layout.jsp I have
the following code:

<t:div id="subnavigation_outer" forceId="true">

    <t:div id="subnavigation" forceId="true"
rendered="#{navigationMenu.leftPanelNavigationConstructed}"
binding="#{navigationMenu.parentUIComponent}">

    </t:div>

</t:div>



In the method isLeftPanelNavigationConstructed HtmlPanelNavigationMenu
component and child HtmlCommandNavigationItem components are added to
the DIV component with id="subnavigation"

At the end of creation of this menu when I view the children of
UIViewRoot then all the components are seen and are properly added.



However when the JSP gets displayed nothing is displayed in the left
navigation.



I am puzzled and I am not able to find a reason. Even though the
UIViewRoot contains the components still it is unable to render any of
the components.



Any help will be appreciated.



Rgds,

Madhav





**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Re: Problems while programmatically adding components

Posted by Simon Kitching <si...@rhe.co.nz>.
Madhav Bhargava wrote:
> Hi All,
> 
>  
> 
> I have a JSP which uses tiles.
> 
> The left menu part of the JSP needs to be programmatically created as 
> the left menu will differ based on the role the use plays.
> 
>  
> 
> In the leftNavigationMenu.jsp – included as a tile in layout.jsp I have 
> the following code:
> 
> <t:div id="subnavigation_outer" forceId="true">
> 
>     <t:div id="subnavigation" forceId="true" 
> rendered="#{navigationMenu.leftPanelNavigationConstructed}" 
> binding="#{navigationMenu.parentUIComponent}">
> 
>     </t:div>
> 
> </t:div>
> 
>  
> 
> In the method isLeftPanelNavigationConstructed HtmlPanelNavigationMenu 
> component and child HtmlCommandNavigationItem components are added to 
> the DIV component with id=”subnavigation”
> 
> At the end of creation of this menu when I view the children of 
> UIViewRoot then all the components are seen and are properly added.
> 
>  
> 
> However when the JSP gets displayed nothing is displayed in the left 
> navigation.
> 
>  
> 
> I am puzzled and I am not able to find a reason. Even though the 
> UIViewRoot contains the components still it is unable to render any of 
> the components.

Are your components nested within a "namespacing container", eg a table 
or a subview? If so, the id will have a prefix eg 
"subviewname:subnavigation_outer".

Also, when using JSF 1.1 with JSP, on first page render components are 
created and rendered in one pass. That means that when a component is 
being processed, any components further down the page don't yet exist 
(and so cannot be found). Using JSF1.2 (not yet implemented by MyFaces) 
or Facelets solves this.

Regards,  Simon