3 Replies Latest reply on May 11, 2016 4:41 AM by michpetrov

    <a4j:commandbutton> not working in richfaces 4.5 and JSF 2.0 and SEAM 2.3

    jondcontact

          <a4j:commandbutton> not working in richfaces 4.5 and JSF 2.0 and SEAM 2.3 , it looks somewhat disabled. <h:commandbutton> works with same action . Please let me know if you have any idea.
         
      **Here is my login.xhtml :**
       

           <!DOCTYPE composition 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:s="http://jboss.org/schema/seam/taglib"
                              xmlns:ui="http://java.sun.com/jsf/facelets"
                              xmlns:f="http://java.sun.com/jsf/core"
                              xmlns:h="http://java.sun.com/jsf/html"
                              xmlns:rich="http://richfaces.org/rich"
                     xmlns:a4j="http://richfaces.org/a4j"
                  template="layout/template.xhtml">
             
              <ui:define name="body">
              
                 <h:form id="form">
                   <h1><h:outputText style="padding-top: 3px;" value="Login" /></h1>
                   <h:panelGrid columns="2" width="100%" columnClasses="topAlign, topAlign">
                    <rich:panel>
                           <div class="dialog">
                           <h:panelGroup style="display:block; text-align:left">
                               <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
                                   <h:outputLabel for="username">Username</h:outputLabel>
                                   <div style="position:absolute; text-align:left; left:0px">
                                   <h:inputText id="username" required="true" requiredMessage="Please Enter Username"
                                             value="#{identity.username}"/>
                                   </div>
                                   <h:outputLabel for="password">Password</h:outputLabel>
                                   <div style="position:absolute; text-align:left; left:0px">
                                   <h:inputSecret id="password" required="true" requiredMessage="Please Enter Password"
                                               value="#{identity.password}"/>
                                   </div>
                                   <div style="position:absolute; text-align:left; left:0px">
                                    <h:outputLabel for="rememberMe">Remember me
                                     <h:selectBooleanCheckbox id="rememberMe" value="#{identity.rememberMe}"/>
                                    </h:outputLabel>
                                   </div>
                               </h:panelGrid>
                           </h:panelGroup>
                           </div>
                        <div class="actionButtons" align="right">
                            <a4j:commandButton render="form" eventsQueue="myQueue" immediate="true" execute="@this" id="loginButton" styleClass="blueButtonSmall" value="Login" action="#{identity.login}">
                             <s:defaultAction />
                            </a4j:commandButton>
                        </div>
                       </rich:panel>
                      
                      </h:panelGrid>
                   
                       
                  </h:form>
             
               </ui:define>
              </ui:composition>
             

         
          **Faces-Config.xml:**
       

           <?xml version='1.0' encoding='UTF-8'?>
              <faces-config version="2.1"
                            xmlns="http://java.sun.com/xml/ns/javaee"
                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
                 <application>
                    <locale-config>
                    <default-locale>en</default-locale>
                    </locale-config>
                 </application>  
                
              </faces-config>

       

       

      Web.xml :

          <?xml version="1.0" ?>
          <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
                   version="3.0">
         
         
             <!-- RichFaces -->
         
         
             <context-param>
                <param-name>org.richfaces.skin</param-name>
                <param-value>company</param-value>
             </context-param>
         
             <!-- Suppress spurious stylesheets -->
         
         
             <context-param>
                <param-name>org.richfaces.enableControlSkinning</param-name>
                <param-value>false</param-value>
             </context-param>
         
         
             <context-param>
                <param-name>org.richfaces.enableControlSkinningClasses</param-name>
                <param-value>false</param-value>
             </context-param>
         
         
             <!-- Change load strategy to DEFAULT to disable sending scripts/styles as packs -->
         
         
             <context-param>
                <param-name>org.richfaces.LoadStyleStrategy</param-name>
                <param-value>ALL</param-value>
             </context-param>
         
             <!-- Seam -->
         
             <listener>
                <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
             </listener>
         
             <filter>
                <filter-name>Seam Filter</filter-name>
                <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
             </filter>
         
             <filter-mapping>
                <filter-name>Seam Filter</filter-name>
                <url-pattern>/*</url-pattern>
             </filter-mapping>
         
             <servlet>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
             </servlet>
         
             <servlet-mapping>
                <servlet-name>Seam Resource Servlet</servlet-name>
                <url-pattern>/seam/resource/*</url-pattern>
             </servlet-mapping>
         
             <!-- Facelets development mode (disable in production) -->
         
         
             <context-param>
                <param-name>facelets.DEVELOPMENT</param-name>
                <param-value>false</param-value>
             </context-param>
            
             <!-- JSF -->
         
             <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
             </context-param>
         
         
           
             <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>*.seam</url-pattern>
             </servlet-mapping>
         
             <security-constraint>
                <display-name>Restrict raw XHTML Documents</display-name>
                <web-resource-collection>
                   <web-resource-name>XHTML</web-resource-name>
                   <url-pattern>*.xhtml</url-pattern>
                </web-resource-collection>
                <auth-constraint/>
             </security-constraint>
         
             <persistence-unit-ref>
                <persistence-unit-ref-name>ASGKitFulfillment/pu</persistence-unit-ref-name>
                <persistence-unit-name>ASGKitFulfillment</persistence-unit-name>
             </persistence-unit-ref>
         
          </web-app>

      <h:commandbutton> works with same action . Please let me know if you have any idea. Also the same a4j:commandbutton works fine when I use richfaces 3.3 , but does not work when I try to upgrade to richfaces 4.5.

        • 1. Re: <a4j:commandbutton> not working in richfaces 4.5 and JSF 2.0 and SEAM 2.3
          michpetrov

          "not working" is really vague. What is happening? What does the generated HTML for the button look like? Seam might not be compatible with RichFaces 4.5, though the defaultAction could probably be switched for rich:hotKey if that's the case.

          • 2. Re: <a4j:commandbutton> not working in richfaces 4.5 and JSF 2.0 and SEAM 2.3
            jondcontact

            Thanks for the reply.  When I click on the button, no action is getting called, nothing happens

             

            This is the code in my .xhtml page

            <div class="actionButtons" align="right">
                          <a4j:commandButton render="form" eventsQueue="myQueue" id="loginButton"   styleClass="blueButtonSmall" value="Login" action="#{identity.login}">
                           <s:defaultAction />
                   </a4j:commandButton>
            </div>

             

             

            Below is generated HTML for the button

            <div class="actionButtons" align="right">
            <script language="JavaScript" type="text/javascript">
            document.forms['form'].onkeypress = new Function("event", "{var keycode;if (window.event) keycode = window.event.keyCode;else if (event) keycode = event.which;else return true;if (keycode == 13)
            { document.getElementById('form:loginButton').click();return false; } else return true; }");
            </script>
            <input id="form:loginButton" name="form:loginButton" onclick="RichFaces.ajax(&quot;form:loginButton&quot;,event,{&quot;incId&quot;:&quot;1&quot;} );
            return false;" value="Login" class="blueButtonSmall" type="submit" />
            </div></div></div>

            • 3. Re: <a4j:commandbutton> not working in richfaces 4.5 and JSF 2.0 and SEAM 2.3
              michpetrov

              That should be working, does the ajax request not fire? I don't know if you can check if the defaultAction listeners executes.