سؤال

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>
هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top