11 Replies Latest reply on Mar 6, 2011 1:43 AM by Ilya Sorokoumov

    double click and css file problem

    kemal taskiran Newbie

      We are using jsf2 with richfaces 4 m6 in jboss 6 final. We made a content panel with facelet and using ajax support we change this panel dynamically. While doing this, we face with two problems,

      1- The commands buttons in the content panels are not response in the first click, after second click this works,

      2- Table css file sometimes is not loaded, so table is not works properly.

        • 1. double click and css file problem
          Rocky S Master

          Please post your code.

          • 2. Re: double click and css file problem
            kemal taskiran Newbie

            Hi Aman,

            This is our template file main-template.xhtml contains contentPanel as in the below,

             

            ...........

            <f:view contentType="text/html">

                <f:loadBundle basename="messages" var="msgs" />

                <h:head>

                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

                    <h:outputStylesheet library="css" name="style.css" />

                    <h:outputStylesheet library="css" name="layout.css" />

                </h:head>

             

                <h:body class="main-template">

             

                    <div id="content" class="content"><ui:insert name="content">

            ............

                        <a4j:outputPanel id="contentPanel">

                            <ui:include src="#{pageViewIdGenaratorBean.contentPage}" />

                        </a4j:outputPanel>

                    </ui:insert></div>

             

                </h:body>

            </f:view>

            .............

             

             

            pageViewGeneratorId.contentPage is changed managed bean,

             

            @ManagedBean(name = "pageViewIdGenaratorBean")

            @SessionScoped

            public class PageViewIdGenaratorBean implements Serializable {

            ...............

                private String contentPage = "/pages/content/mainPage.xhtml";

             

                public void sayfaSec(ActionEvent event) {

                    FacesContext context = FacesContext.getCurrentInstance();

                    String pageId = context.getExternalContext().getRequestParameterMap().get("page");

             

                    if (pageId.equalsIgnoreCase("userPage")) {

                        contentPage = "/content/userPage.xhtml";

                    }

                 }

             

            ..............

            }

             

            Our userPage.xhtml is,

             

                <rich:panel>

                    <f:facet name="header">

                    User Add

                    </f:facet>

             

                    <h:form id="userAddForm">

            .....................................

                        <h:panelGroup style="width:100%;">

                            <h:commandButton

                                action="#{userBean.add}" value="OK"

                                style="margin-right:15px;">

                                <f:param id="userParamAdd" name="page" value="userPage"></f:param>

                                <f:ajax render=":contentPanel" execute="@form"></f:ajax>

                            </h:commandButton>

            .................................

             

             

                    </h:form>

                </rich:panel>

             

            Thank you for response, I will add the source code for css problem, and also in the post the double click problem is mentioned,

             

            http://community.jboss.org/thread/162853?tstart=0

             

             

             

            Kemal

            • 3. Re: double click and css file problem
              kemal taskiran Newbie

              Hi Aman,

              Our css related problem occurs code in the below. And its picture is in the attached picture.

               

              My table code is,

               

              <rich:extendedDataTable value="#{kullaniciBean.kullaniciListesi}"

                                  selection="#{kullaniciBean.selection}"

                                  style="width:800px;" var="kullanici"

                                  id="kullaniciTable" rows="10">

                                  <a4j:ajax execute="@form" event="selectionchange"

                                      listener="#{kullaniciBean.selectionListener}"

                                      render=":contentPanel" />

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Giriş Adı " />

                                      </f:facet>

                                      <h:outputText value="#{kullanici.girisAdi}" />

                                  </rich:column>

                                  <rich:column>

                                      <f:facet name="header">

                                          <h:outputText value="Adı" />

                                      </f:facet>

                                      <h:outputText value="#{kullanici.adi}" />

                                  </rich:column>

                                 ------------------------------------ 

               

                              </rich:extendedDataTable>

                              <rich:dataScroller for="kullaniciTable" maxPages="5" />

               

              Regards,

              Kemal

              • 4. double click and css file problem
                liumin hu Master

                hi,

                 

                Could you try set contentPage default value to "userPage.xhtml"?

                 

                liu

                • 5. double click and css file problem
                  kemal taskiran Newbie

                  Hi liu,

                   

                  I am setting the contentPage default value "userPage.xhtml", but double click problem continues, hovewer css file for table is loaded but after changing the contentPage and then setting the contentPage "userPage.xhtml" table css file is not loaded again.

                   

                  Regards,

                  Kemal

                  • 6. double click and css file problem
                    Rocky S Master

                    1) In your h:commandButton, use following attribute- onclick="document.getElementById(this).submit()"

                    2) CSS File not loading, make you have directory structure in your war file-

                    /resources/css/styles.css

                    • 7. Re: double click and css file problem
                      kemal taskiran Newbie

                      Hi Aman,

                       

                      While I am setting the onclick event as you say but problem is continues, hovewer as Liu said that when I am setting the default page userPage this problem solved for userPage or default page whichever I set, but when I am changing the contentPage dynamically as other page, this problem contiunes.

                       

                      The css file is not our css file, richfaces table default css file, while we looking with firebug we couldn't see this file for table in the situation of which can be seen in picture.

                       

                      Kemal

                      • 8. double click and css file problem
                        Raúl Fernando Casallas Malaver Newbie

                        Hi, I'm having the same problem (double-click issue), i'm using facelets... maybe it is the problem?... there is not strange code... just a usual form:

                         

                        <ui:composition 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:a4j="http://richfaces.org/a4j"

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

                                  template="/template/main.xhtml">

                                  <ui:define name="title">

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

                                  </ui:define>

                                  <ui:define name="content">

                                 <h:form id="createAccountForm">

                                     <h:messages globalOnly="true" errorClass="errorClass" infoClass="infoClass" fatalClass="fatalClass" warnClass="warnClass" />

                                     <h:panelGrid columns="3" border="0">

                                         <h:outputLabel value="#{msg['createAccount.firstName']}" for="firstName" />

                                         <h:inputText label="#{msg['createAccount.firstName']}" value="#{accountBean.user.firstName}" id="firstName" required="true">

                                             <f:validateLength minimum="3" maximum="45" />

                                             <rich:validator />

                                         </h:inputText>

                                     </h:panelGrid>

                                     <h:panelGrid columns="2" border="0" width="80%">

                                         <a4j:commandButton render="createAccountForm" value="#{msg['createAccount.createAccount']}" action="#{accountBean.createAccount}" />

                                                                                    <a4j:commandButton render="createAccountForm" value="#{msg['createAccount.cancel']}" onclick="document.getElementById(this).submit()" action="cancel" immediate="true" />

                                     </h:panelGrid>

                                 </h:form>

                              </ui:define>

                        </ui:composition>

                        • 9. double click and css file problem
                          liumin hu Master

                          hi,

                           

                          i think the problem is ui:include. your "userPage.xhtml" is not present when creat view phase. so i suggested change the default page.

                           

                          Could you try just reload your page(F5 or reenter the url) after navigate in userPage?

                           

                          liu

                          • 10. Re: double click and css file problem
                            kemal taskiran Newbie

                            Hi,

                             

                            I try to relaod after navigation and this works, but problem is continues. Finally we find a solution that we remove the forms in the contentPages that means inside of ui:define and insert a form outside of ui: include, than we refresh this form with f:ajax, than it works, so as you said this problem is related with ui:define.

                             

                            Kemal