5 Replies Latest reply on May 16, 2007 6:20 AM by Ilya Shaikovsky

    I have problems with a4j:repeat / ui:repeat + rich:toolBar +

    Thai Dang Vu Apprentice

      Environment: java 1.6, a4j & richfaces from richfaces 3.0.1 RC2, facelets 1.1.12, jsf ri 1.2_04_p1

      This is my bean:

      public class TestStuffPiece1 {
       private List<DropDownMenu> dropDownMenus = new ArrayList<DropDownMenu>();
      
       public TestStuffPiece1() {
       dropDownMenus.add(new DropDownMenu("File"));
       dropDownMenus.add(new DropDownMenu("View"));
       }
      
       public List<DropDownMenu> getDropDownMenus() {
       return dropDownMenus;
       }
      
       public void setDropDownMenus(List<DropDownMenu> dropDownMenus) {
       this.dropDownMenus = dropDownMenus;
       }
      }

      DropDownMenu.java:
      public class DropDownMenu {
       private String value;
      
       public DropDownMenu(String value) {
       this.value = value;
       }
      
       public String getValue() {
       return value;
       }
      }

      My xhtml file:
      <rich:toolBar>
       <a4j:repeat value="#{testStuffPiece1.dropDownMenus}" var="dropDownMenu">
       <rich:dropDownMenu value="#{dropDownMenu.value}">
       <rich:menuItem value="Open ..." action="a" />
       <rich:menuItem value="Save ..." action="a" />
       <rich:menuSeparator />
       <rich:menuItem value="Exit" action="a" />
       </rich:dropDownMenu>
       </a4j:repeat>
      </rich:toolBar>
      This code causes the File and View menu vertically aligned.
      But everything is fine (File and View meny are horizontally aligned) if I replace that a4j:repeat line with
      <rich:toolBar>
       <rich:dropDownMenu value="File">
       <rich:menuItem value="Open ..." action="a" />
       <rich:menuItem value="Save ..." action="a" />
       <rich:menuSeparator />
       <rich:menuItem value="Exit" action="a" />
       </rich:dropDownMenu>
       <rich:dropDownMenu value="View">
       <rich:menuItem value="Open ..." action="a" />
       <rich:menuItem value="Save ..." action="a" />
       <rich:menuSeparator />
       <rich:menuItem value="Exit" action="a" />
       </rich:dropDownMenu>
      </rich:toolBar>

      So, what's the problem here?

        • 1. Re: I have problems with a4j:repeat / ui:repeat + rich:toolB
          Ilya Shaikovsky Master

          You may create menu you wanted using

           <rich:toolBar>
           <c:forEach var="cap" items="#{capitalsBean.capitals}">
           <rich:dropDownMenu value="#{cap.name}">
           <rich:menuItem value="#{cap.timeZone}"></rich:menuItem>
           <rich:menuItem value="#{cap.state}"></rich:menuItem>
           </rich:dropDownMenu>
           </c:forEach>
           </rich:toolBar>
          


          • 2. Re: I have problems with a4j:repeat / ui:repeat + rich:toolB
            Ilya Shaikovsky Master

            but I think in your case.. the right way will be use binding on the whole toolBar and create child menus inside.

            • 3. Re: I have problems with a4j:repeat / ui:repeat + rich:toolB
              Thai Dang Vu Apprentice

               

              "ilya_shaikovsky" wrote:
              use binding on the whole toolBar and create child menus inside.
              Could you explain it a little bit or show me where to read?

              I prefer some other way to do this than using c:forEach because I don't see any way to specify the action for each rich:menuItem.

              • 4. Re: Cannot use JSTL 1.2
                Thai Dang Vu Apprentice

                Environment: java 6; facelets 1.1.12; jsf ri 1.2_04 p1; a4j, richfaces 3.0.1 rc3. This is a part of my code:

                <h:form xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                 xmlns:c="http://java.sun.com/jsp/jstl/core">
                 <rich:toolBar>
                 <c:forEach items="#{testStuffPiece1.dropDownMenus}" var="dropDownMenu">
                 <rich:dropDownMenu value="#{dropDownMenu.value}">
                 <rich:menuItem value="Open ..." action="a" />
                 <rich:menuItem value="Save ..." action="a" />
                 <rich:menuSeparator />
                 <rich:menuItem value="Exit" action="a" />
                 </rich:dropDownMenu>
                 </c:forEach>
                 </rich:toolBar>
                </h:form>

                The error is:
                XML Parsing Error: prefix not bound to a namespace
                Location: http://localhost:8383/acegi-ex/admin/user-role.jsf
                Line Number 161, Column 9:
                 <c:forEach items="[teststuff.bean.DropDownMenu@4218cb, teststuff.bean.DropDownMenu@169c6f2]" var="dropDownMenu"></td><td class="dr-toolbar-int rich-toolbar-item "><div class=" dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect" id="j_id25:j_id26:j_id29" onmouseout="this.className='dr-menu-label dr-menu-l
                --------^
                Sorry for asking about JSTL here.