4 Replies Latest reply on Apr 11, 2011 10:06 AM by edilmar

    RichFaces4 menuItem ajax x server

    edilmar

      Hi,

       

      My development environment is: NetBeans 7.0 RC1 + GlassFish 3.1 + JSF2 + Mojarra 2.1.0 + Weld 1.1 + RichFaces 4 final + Firefox4/Chrome9.

       

      I had a toolBar + dropDownMenu in RF 3.3.3 into a a4j:region, and all menuItems were configured with ajax mode. And a a4j:status + rich:modalPanel to display a message "Processing..." when loading each option, something like this. Then, I migrated to RF 4.0.0 toolbar. Problem: when I use ajax mode, any option doesn't process its xhtml correctly, but if I change to server mode, the xhtml is processed. The other problem is that the server mode doesn't run the a4j:status + rich:popupPanel.

       

      Below is the code for teste.xhtml:

       

      <?xml version='1.0' encoding='UTF-8' ?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                      xmlns:h="http://java.sun.com/jsf/html"

                      xmlns:f="http://java.sun.com/jsf/core"

                      xmlns:ui="http://java.sun.com/jsf/facelets"

                      xmlns:a4j="http://richfaces.org/a4j"

                      xmlns:rich="http://richfaces.org/rich"

                      template="/WEB-INF/templates/templateTeste.xhtml"

                      >

        <ui:define name="content">

          <a4j:log mode="popup">

            <a4j:region id="a4j_menu">

              <a4j:status onstart="#{rich:component('splash')}.show()" onstop="#{rich:component('splash')}.hide()" />

              <rich:popupPanel id="splash" autosized="true" width="200" height="80" moveable="false" resizeable="false">

                <f:facet name="header"><h:outputText value="#{msgGeral['splash.titulo']}" /></f:facet>

                <h:outputText value="#{msgGeral['splash.msg']}" />

              </rich:popupPanel>

              <h:form id="form">

                <rich:toolbar>

                  <rich:dropDownMenu>

                    <f:facet name="label">

                      <h:panelGroup>

                        <h:outputText value="Menu1"/>

                      </h:panelGroup>

                    </f:facet>

                    <rich:menuItem mode="server" label="MenuItem1"

                                   action="#{teste.actionMenuItem1}">

                    </rich:menuItem>

                  </rich:dropDownMenu>

                </rich:toolbar>

              </h:form>

            </a4j:region>

          </a4j:log>

        </ui:define>

      </ui:composition>

       

      The wrong page showed when using ajax mode:

      menuItemAjax.jpeg

      The right same page showed when using server mode:

      menuItemServer.jpeg

      Then, I would like to use ajax mode because of a4j:status+rich:popupPanel, but I would like RichFaces rendered correclty the destination page. I tested with other pages and the result is always the same.

        • 1. RichFaces4 menuItem ajax x server
          ilya_shaikovsky

          Only redirect navigation will works.. something like:

           

          <h:commandLink style="font-size:14px;" value="rich:dataTable styling" action="tableStyling?faces-redirect=true">

                                        <a4j:ajax/>

                              </h:commandLink>

           

          for simple link.

           

          in other case JSF 2 will not be able to load resources

          • 2. Re: RichFaces4 menuItem ajax x server
            edilmar

            Hi,

             

            I didn't understand where to use the h:commandLink because I need to use menuItems, not simples links.

            The problem that I have now is to configure toolbar+dropDownMenu+menuItem using ajax mode, not a problem with dataTable/columns like other problem I took about before.

            • 3. Re: RichFaces4 menuItem ajax x server
              ilya_shaikovsky

              I do not want to say that you need links.

              Problem: when I use ajax mode, any option doesn't process its xhtml correctly, but if I change to server mode, the xhtml is processed.

              Just explaining why ajax not works. It will works only with redirect navgation. You if can't use redirect - have to use server mode. And that's JSF 2 limitation.

              • 4. Re: RichFaces4 menuItem ajax x server
                edilmar

                OK. But how could I change my code to redirect, not simple menuItem? Could I put your commandLink code into menuItem?