5 Replies Latest reply on Jul 10, 2009 10:18 AM by Ilya Shaikovsky

    Problem with menuItem (not rendered)

    Thomas Trepper Newbie

      Hi all,

      I have a page like follows:

      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
      <%@ include file="includes/taglibs.jsp"%>
      <f:view locale="#{currentUserBean.locale}">
      <f:loadBundle basename="#{currentUserBean.resourceBundlePath}" var="message"/>
      
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      ...
      </head>
      
      <body>
      <h:form>
       <rich:toolBar>
       <rich:dropDownMenu>
       <f:facet name="label">
       <h:panelGroup>
       <h:graphicImage value="/icons/wrench.png" styleClass="menuIcon" rendered="true"/>
       <h:outputText value="System"/>
       </h:panelGroup>
       </f:facet>
      
       <rich:menuItem value="Overview" /> <%--icon="/icons/house.png" --%>
      
       <rich:menuSeparator id="menuSeparator11" />
      
       <rich:menuItem value="Logout" id="navMenuItemLogout">
       <f:facet name="label">
       <h:graphicImage value="/icons/house.png" styleClass="menuIcon" rendered="true"/>
       <h:outputText value="Logout" />
       </f:facet>
       </rich:menuItem>
       </rich:dropDownMenu>
       </rich:toolBar>
      </h:form>
      </body>
      </html>
      </f:view>
      

      The toolbar is rendered and visible, the first menu-item (called system here) also, but the submenus are empty. No text visible, no icons visible, nothing. Only empty with a separator.

      Does anybody has an idea what I am doing wrong?

      Thanks a lot and best regards,

      Thomas

      P.S: Using the lastest Version 3.3.1 GA, Sun-Faces 1.2 and Tomcat 6.0.20

        • 1. Re: Problem with menuItem (not rendered)
          Ilya Shaikovsky Master

          Seems should just works. Any js errors? Any resources failed to load?

          • 2. Re: Problem with menuItem (not rendered)
            Thomas Trepper Newbie

            No, sorry - no errors, no failed resources. Page loads normally. If it helps, I can post the html-output.

            Could it be cecause of the page-header? Transitional? Page-Syntax not using ui:...

            The libs are placed in tomcat-webapp-webinf-libs

            • 3. Re: Problem with menuItem (not rendered) (still open)
              Thomas Trepper Newbie

              The problem still exists. I also tried 3.3.0 and 3.1.6 and the problem war reproducable. Am I missing libraries?

              Under WebContent-WebINF-lib I have:


              commons-beanutils-1.8.0.jar
              commons-collections-3.2.1.jar
              commons-digester-2.0.jar
              commons-logging-1.1.1.jar
              jsf-api.jar
              jsf-impl.jar
              jstl.jar
              richfaces-api-3.3.1.GA.jar
              richfaces-impl-3.3.1.GA.jar
              richfaces-ui-3.3.1.GA.jar
              themes-3.3.1.GA.jar


              Can anybody reproduce my problem?

              My web.xml looks like this:

              <!-- Context-Parameter -->
               <context-param>
               <param-name>org.richfaces.SKIN</param-name>
               <param-value>blueSky</param-value>
               </context-param>
               <context-param>
               <!-- MUST be set to client, because of browser-back-button-problem, which
               means, that the two UI-Root-IDs (when stored on server) are not the
               same, when a browser-back-button is used.
               -->
               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
               <param-value>client</param-value>
               </context-param>
              
               <!-- Faces-config -->
               <context-param>
               <param-name>javax.faces.CONFIG_FILES</param-name>
               <param-value>/WEB-INF/faces-config.xml</param-value>
               </context-param>
              
               <!-- Faces -->
               <servlet>
               <servlet-name>Faces Servlet</servlet-name>
               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
               <servlet-mapping>
               <servlet-name>Faces Servlet</servlet-name>
               <url-pattern>*.jsf</url-pattern>
               </servlet-mapping>
              
               <!-- Filter -->
               <filter>
               <display-name>RichFaces Filter</display-name>
               <filter-name>richfaces</filter-name>
               <filter-class>org.ajax4jsf.Filter</filter-class>
               </filter>
               <filter-mapping>
               <filter-name>richfaces</filter-name>
               <servlet-name>Faces Servlet</servlet-name>
               <dispatcher>REQUEST</dispatcher>
               <dispatcher>FORWARD</dispatcher>
               <dispatcher>INCLUDE</dispatcher>
               </filter-mapping>
              
               <!-- Welcome files -->
               <welcome-file-list>
               <welcome-file>index.jsf</welcome-file>
               </welcome-file-list>
              



              Any help appreciated. Thanks a lot
              Thomas

              • 4. Re: Problem with menuItem (not rendered)
                Mikhail Vitenkov Newbie

                ttrepper
                I found two bugs in your code:
                1) There is no "label" facet for rich:menuItem, use "icon" instead.
                2) The 2nd facet have two childs.

                <f:facet name="label">
                 <h:graphicImage value="/icons/house.png" styleClass="menuIcon" rendered="true"/>
                 <h:outputText value="Logout" />
                 </f:facet>
                

                Try to replace with following code:
                <rich:menuItem value="Logout" id="navMenuItemLogout">
                 <f:facet name="icon">
                 <h:graphicImage value="/pics/error.gif" styleClass="menuIcon"
                 rendered="true" />
                 </f:facet>
                 </rich:menuItem>
                

                If it will not help you - let us know.

                • 5. Re: Problem with menuItem (not rendered)
                  Ilya Shaikovsky Master

                  about 1) icon facet should not be used instead of label. It defines icon. And label part should be defined by just nested components