5 Replies Latest reply on Jun 14, 2013 8:19 AM by zsv

    popupPanel with tabPanel render problem

    zsv

      Hello.

       

      I have a problem with tabPanel in popupPanel: after render tabs not changed via ajax.

       

      Here example:

       

      <a4j:commandButton
          value="show"
          execute="@this"
            render="pPnl"
            oncomplete="#{rich:component('pPnl')}.show()">
      </a4j:commandButton>
      
      <rich:popupPanel id="pPnl" modal="true">
      <h:form>
                  <rich:tabPanel id="tp">
              <rich:tab header="1">
                  111
              </rich:tab>
              <rich:tab header="2">
                  222
              </rich:tab>
              <rich:tab header="3">
                  333
              </rich:tab>
              </rich:tabPanel>
      
      </h:form>
      </rich:popupPanel>
      

       

      When popup panel opened tabs not changed. If I remove render="pPnl" tabs is changed, but in real code I need to reload tab content during popup is opening.

       

      using jboss 7.1 with gatein 3.5. richfaces 4.3.1

       

      Please help!

        • 1. Re: popupPanel with tabPanel render problem
          bleathem

          Do you see any errors in the javascript console of your browser?

          • 2. Re: popupPanel with tabPanel render problem
            zsv

            No errors in console (server and browser). Ajax request returned http 200 OK, but tab is not changed.

            • 3. Re: popupPanel with tabPanel render problem
              bleathem

              Can you post your full facelet file?  Remember neither HTML nor JSF works with nested forms.  If you are using a new enough release of both Mojarra and RichFaces, you should be able to use adjacent forms.

              • 4. Re: popupPanel with tabPanel render problem
                zsv

                index.xhtml:

                 

                 

                <!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" 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">
                
                <body>
                    <ui:composition template="/templates/template.xhtml">
                
                        <ui:define name="title">RichFaces Sample</ui:define>
                
                        <ui:define name="body">
                            <h:form prependId="false">
                                <h:outputLabel value="Name:" for="nameInput" />
                                <h:inputText id="nameInput" value="#{richBean.name}">
                                    <a4j:ajax event="keyup" render="output" />
                                </h:inputText>
                                <h:panelGroup id="output">
                                    <h:outputText value="Hello #{richBean.name}!"
                                        rendered="#{not empty richBean.name}" />
                                </h:panelGroup>
                            </h:form>
                
                <a4j:commandButton
                    value="show"
                      render="pPnl"
                      oncomplete="#{rich:component('pPnl')}.show()">
                </a4j:commandButton>
                <rich:popupPanel id="pPnl" modal="true">
                
                <h:form>
                            <rich:tabPanel id="tp">
                        <rich:tab header="1">
                            #{richBean.name}
                        </rich:tab>
                        <rich:tab header="2">
                            222
                        </rich:tab>
                        <rich:tab header="3">
                            333
                        </rich:tab>
                        </rich:tabPanel>
                </h:form>
                
                                <input type="button"
                                    value="close"
                                    onclick="#{rich:component('pPnl')}.hide()"
                                    class="btn jbtn niceBtn" />
                </rich:popupPanel>
                
                
                        </ui:define>
                    </ui:composition>
                </body>
                </html>
                

                 

                template.xhtml:

                 

                 

                <!DOCTYPE html>
                <html 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">
                
                <h:head>
                    <title>RichFaces Application</title>
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
                    </h:head>
                
                <h:body>
                        <ui:insert name="body">Default content</ui:insert>
                </h:body>
                </html>
                

                 

                RichBean.java:

                 

                 

                package org.docs.richfaces;
                
                import java.io.Serializable;
                
                import javax.annotation.PostConstruct;
                import javax.faces.bean.ManagedBean;
                import javax.faces.bean.ViewScoped;
                
                @ViewScoped
                @ManagedBean
                public class RichBean implements Serializable {
                
                    private static final long serialVersionUID = -6239437588285327644L;
                
                    private String name;
                
                    @PostConstruct
                    public void postContruct() {
                        name = "John";
                    }
                
                    public String getName() {
                        return name;
                    }
                
                    public void setName(String name) {
                        this.name = name;
                    }
                }
                

                 

                 

                web.xml:

                 

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
                  <display-name>Sample RichFaces 4 Application</display-name>
                  <!-- context-param>
                      <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
                      <param-value>true</param-value>
                </context-param--> 
                  
                  <context-param>
                    <param-name>javax.faces.PROJECT_STAGE</param-name>
                    <param-value>Development</param-value>
                  </context-param>
                  <context-param>
                    <param-name>javax.faces.SKIP_COMMENTS</param-name>
                    <param-value>true</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>*.xhtml</url-pattern>
                  </servlet-mapping>
                  <servlet-mapping>
                    <servlet-name>Faces Servlet</servlet-name>
                    <url-pattern>/faces/*</url-pattern>
                  </servlet-mapping>
                  <servlet>
                    <servlet-name>Resource Servlet</servlet-name>
                    <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
                    <load-on-startup>1</load-on-startup>
                  </servlet>
                  <servlet-mapping>
                    <servlet-name>Resource Servlet</servlet-name>
                    <url-pattern>/org.richfaces.resources/*</url-pattern>
                  </servlet-mapping>
                  <context-param>
                    <param-name>org.richfaces.resourceMapping.enabled</param-name>
                    <param-value>true</param-value>
                  </context-param>
                  <session-config>
                    <session-timeout>30</session-timeout>
                  </session-config>
                  <welcome-file-list>
                    <welcome-file>faces/index.xhtml</welcome-file>
                  </welcome-file-list>
                </web-app>
                
                • 5. Re: popupPanel with tabPanel render problem
                  zsv

                  this works for me:

                   

                   

                  <!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" 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">
                  
                  <body>
                      <ui:composition template="/templates/template.xhtml">
                  
                          <ui:define name="title">RichFaces Sample</ui:define>
                  
                          <ui:define name="body">
                              <h:form prependId="false">
                                  <h:outputLabel value="Name:" for="nameInput" />
                                  <h:inputText id="nameInput" value="#{richBean.name}">
                                      <a4j:ajax event="keyup" render="output" />
                                  </h:inputText>
                                  <h:panelGroup id="output">
                                      <h:outputText value="Hello #{richBean.name}!"
                                          rendered="#{not empty richBean.name}" />
                                  </h:panelGroup>
                              </h:form>
                  
                  <a4j:commandButton
                      value="show"
                        execute="@this"
                        render="containerForm"
                        oncomplete="#{rich:component('pPnl')}.show()">
                  </a4j:commandButton>
                  <h:form id="containerForm">
                  <rich:popupPanel id="pPnl" modal="true" domElementAttachment="form">
                  
                              <rich:tabPanel id="tp">
                          <rich:tab header="1">
                              #{richBean.name}
                          </rich:tab>
                          <rich:tab header="2">
                              222
                          </rich:tab>
                          <rich:tab header="3">
                              333
                          </rich:tab>
                          </rich:tabPanel>
                  
                                  <input type="button"
                                      value="close"
                                      onclick="#{rich:component('pPnl')}.hide()"
                                      class="btn jbtn niceBtn" />
                  </rich:popupPanel>
                  </h:form>
                              
                          </ui:define>
                      </ui:composition>
                  </body>
                  </html>