0

I'm trying to add a JSF selectOneMenu in a UI fragment using icefaces 1.8 and cannot get it to render no matter what I do. I can get it to render in a normal jspx page but not within a ui fragment.

<ui:fragment xmlns="http://www.w3.org/1999/xhtml"  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ice="http://www.icesoft.com/icefaces/component">
    <ice:selectOneMenu id="myselect"
                       style="width:100px"
                       value="#{someField}"  
                       rendered="true">                                         
                             <f:selectItem itemValue="1" itemLabel="1"/>
                             <f:selectItem itemValue="2" itemLabel="2"/>
                             <f:selectItem itemValue="3" itemLabel="3"/>
                     </ice:selectOneMenu>
</ui:fragment>

Am I missing something basic? I am new to JSF. If I pull out the exact same selectOneMenu into a jspx it works as it should but when I include a ui fragment it does not.

Edit for BalusC:

The fragment is used later in a jspx file that is pulled in with

<ui:include src="myfile.jspx">
   <ui:param name="someField" value="#{beanName.someField}"
</ui:include>

I am going off of an existing . There is a lot more in the include that all works as expected and I can add other components like outputText into the ui:fragment but it doesn't make any difference. The full fragment is below. I can post the full include from the jspx as well.

<ui:fragment xmlns="http://www.w3.org/1999/xhtml"  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ice="http://www.icesoft.com/icefaces/component">

    <ice:panelGrid cellspacing="0" cellpadding="0" columns="3">
        <!-- This component is displayed when the form is opened for editing or display mode-->
        <ice:panelGroup rendered="#{not beanName.outputOnlyView }">

                <!-- This component is displayed when the form is opened for display mode in EDM stage-->
                <ice:panelGroup rendered="#{beanName.displayMode}">
                        <ice:outputText 
                                        id="#{fieldId }" 
                                        style="#{inlineStyleField}" 
                                        value="#{fieldValue}"  >
                        </ice:outputText>
                </ice:panelGroup>   

                    <ice:selectOneMenu id="myselect"
                                              style="width:100px"
                                              value="#{someField}"
                                              rendered="#{not beanName.outputOnlyView}">                                            
                             <f:selectItem itemValue="IntranetID" itemLabel="Intranet ID"/>
                             <f:selectItem itemValue="Name" itemLabel="Last Name, First Name"/>
                             <f:selectItem itemValue="KnownAs" itemLabel="Known As"/>
                     </ice:selectOneMenu>

                <!-- This component is displayed when the form is opened for editing mode in Submitter stage-->
                <ice:panelGroup rendered="#{!beanName.displayMode}" panelTooltip="#{fieldId}Help">
                    <ice:panelGrid style="#{inlineStyle}" cellspacing="0" cellpadding="0" columns="3">
                        <!-- Column 1 the component -->
                        <ice:selectInputText id="#{fieldId }"          
                                             binding="#{feildBinding}"                       
                                             options="{frequency:0.4}"
                                             rows="20"   
                                             width="100"
                                             partialSubmit="true"
                                             immediate="true"
                                             autocomplete="true"                                    
                                             value="#{fieldValue}"
                                             rendered="#{not beanName.outputOnlyView}"
                                             readonly="#{beanName.globalReadOnly }"
                                             listVar="employee"
                                             listValue="#{beanName[employeeSelect].employeeNamePossibilities}"
                                             valueChangeListener="#{beanName[valueChangeListener] }"
                                             textChangeListener="#{beanName[textChangeListener]}">
                            <f:facet name="selectInputText">
                                <ice:panelGrid columns="1">
                                    <ice:panelGrid columns="2" columnClasses="searchCol1,searchCol2">
                                        <ice:outputText id="name" value="#{employee.name}"/>
                                        <ice:outputText id="email" value="#{employee.email}"/>
                                    </ice:panelGrid>
                                    <ice:panelGrid columns="3" columnClasses="searchCol4,searchCol3,searchCol5">
                                        <ice:outputText id="function" value="#{employee.function}"/>
                                        <ice:outputText id="subfunction" value="#{employee.subfunction}"/>
                                        <ice:outputText id="stat1" value="#{employee.stat1}"/>
                                    </ice:panelGrid>
                                </ice:panelGrid>
                            </f:facet>          
                        </ice:selectInputText>                  
                        <!-- Column 2:  Error Messages for this component -->
                        <ice:message style="color:red;" id="#{fieldId}Error" for="#{fieldId}" showDetail="true"/> 

                        <!-- Column 3:  HoverHelp if required -->
                        <ui:include src="../inc-components-pcr/sub-components-pcr/hoverHelpColumnAndTooltip.jspx"/>             
                    </ice:panelGrid>
                </ice:panelGroup>   
        </ice:panelGroup>

    </ice:panelGrid>
</ui:fragment>
Ryan
  • 204
  • 3
  • 12
  • 1
    How exactly are you ultimately using this fragment? Where exactly did you learn about writing code this way? Please post the problem in flavor of a copy'n'paste'n'runnable SSCCE if you don't have the basic concepts and terminology straight yet. – BalusC Sep 17 '13 at 13:26
  • Hi BalusC. Please see the edit. Ultimately the fragment gets pulled in to a much larger form. The fragment is used so that we can have a standard autocomplete search. I am simply trying to add a dropdown to that autocomplete search on the same line. – Ryan Sep 17 '13 at 13:42
  • 1
    What exactly is the reason you're using `` instead of `` as shown in Facelets documentation and all sane Facelets tutorials? – BalusC Sep 17 '13 at 13:43
  • I was using something that was already in place. Changing it to ui:composition has the same issue. – Ryan Sep 17 '13 at 14:01
  • Ran into an interesting issue that may help. I am using this facelet in multiple places in my jspx. In one part it is hidden unless a user selects on a radio button then it is shown. In that case the selectOneMenu shows up as expected. Is this some rendering issue? – Ryan Sep 17 '13 at 17:28

1 Answers1

0

I was including the template multiple times on the page which was causing multiple instances of the same id causing it to not render at all. Hence the behavior at the end where an initially hidden one was able to show since the initial render would not render any leaving that ID as available. Dumb mistake.

Ryan
  • 204
  • 3
  • 12