1 Reply Latest reply on Oct 3, 2013 3:18 PM by Brian Leathem

    unable to view rich panel

    srini vasan Newbie

      I have peculiar situation. In my JSF project, I have some XHTMLs, which contains rich:panels, rich:dropDownMenu, rich:toolbar. When I run it directly in Eclipse (by right click operation and run on server) I can get the desired output. But whenever this page is triggered from another page or action from any other page, I could only see the rich:dropDownMenu, not the rich:panel i.e the contents of the panel will be displayed but not the panel.

       


       

      test.jpg

      The above image is AddEmployee.xhtml. The first one is output when i run it directly. The second one is when i reach that page via Login.xhtml. My question why i cant view the rich:panel in the second one. Find the related codes here.

       

      Faces.config.xml

       

      <faces-config
          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_0.xsd"
          version="2.0">
      <managed-bean>
             <managed-bean-name>MenuBean</managed-bean-name>
             <managed-bean-class>org.com.bean.MenuBean</managed-bean-class>
             <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
      <managed-bean>
             <managed-bean-name>UserLogin</managed-bean-name>
             <managed-bean-class>org.com.bean.UserLogin</managed-bean-class>
             <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
      <managed-bean>
             <managed-bean-name>EmployeeMaster</managed-bean-name>
             <managed-bean-class>org.com.bean.EmployeeMaster</managed-bean-class>
             <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
      <navigation-case>
                    <from-action>#{MenuBean.addEmployee}</from-action>
                    <from-outcome>AddEmployee</from-outcome>
                    <to-view-id>/employee/AddEmployee.xhtml</to-view-id>
      </navigation-case>
      </faces-config>
      


      Header.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:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfaces.org/rich"
             xmlns:ui="http://java.sun.com/jsf/facelets">
                             
             <rich:toolbar height="46px">
                           <rich:dropDownMenu mode="ajax" verticalOffset="1">
                                 <f:facet name="label">
                                         <h:outputText value="Home"/>
                                  </f:facet>
                                  <rich:menuItem label="Home" action="#{MenuBean.showHome}"></rich:menuItem>
                           </rich:dropDownMenu>
                           <rich:dropDownMenu mode="ajax">
                                  <f:facet name="label" >
                                         <h:outputText value="Employee"/>
                                  </f:facet>
                                  <rich:menuItem label="AddEmployee" action="#{MenuBean.addEmployee}"></rich:menuItem>
                                  <rich:menuItem label="EmployeeDetails" action="#{MenuBean.showEmployeeDetails}"></rich:menuItem>
                                  <rich:menuItem label="TerminateEmployee" action="#{MenuBean.terminateEmployee}"></rich:menuItem>
                                  <rich:menuItem label="UpdateEmployee" action="#{MenuBean.updateEmployee}"></rich:menuItem>
                           </rich:dropDownMenu>
                    </rich:toolbar>
      </ui:composition>
      

       

      Login.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:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfaces.org/rich"
             xmlns:ui="http://java.sun.com/jsf/facelets">
             <h:head>
                    <title> Login </title>
             </h:head>
         
             <body>
             <h:form>
             <center>
             <rich:panel header="Login" style="text-align:left;font-style:normal;text-decoration:none;width : 343px; height : 181px; color: Black;">
                    <center>
                
                           <h:outputText value="Username"/>    
                           <h:inputText id="username" value="#{UserLogin.userName}" required="true">       </h:inputText>
                                 <h:outputText value="&lt;br/&gt;" escape="false" />
                                 <h:outputText value="&lt;br/&gt;" escape="false" />
                           <h:outputText value="Password"/>     
                           <h:inputText id="password" value="#{UserLogin.userPwd}" required="true"></h:inputText>
                                 <h:outputText value="&lt;br/&gt;" escape="false" />
                                 <h:outputText value="&lt;br/&gt;" escape="false" />
                             
                           <h:commandButton value="Login"
                                               action="#{UserLogin.login}" />    
                           <h:commandButton type="reset" value="reset"/>
                       
                    </center>
             </rich:panel>
             </center>
             </h:form>
      </body>
      </ui:composition>
      


      AddEmployee.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">
      <html xmlns="http://www.w3.org/1999/xhtml"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfaces.org/rich"
             xmlns:ui="http://java.sun.com/jsf/facelets">
             <h:head>
                    <title> Add new employee </title>
             </h:head>
         
             <body>
             <h:form>
                
                    <ui:insert name="CommonHeader">
                           <ui:include src="/Header.xhtml"></ui:include>
                    </ui:insert>
         
             <!-- Header definition over -->
                           <br></br>
                           <table align="left" cellspacing="0" border="0" cellpadding="5">
                             <tr><td>
                             <rich:panel header="Employee Primary Details" style="text-align:left;font-style:normal;text-decoration:none;width : 350px; height : 200px;" rendered="true">
                                            
      <h:outputText value="Enter User name : "  style="FONT-WEIGHT: bold;"/>                
                                 <h:inputText id="empIde" value="#{EmployeeMaster.empId}" />
                       
                                 <br/><br/>
                                                                                    
                                 <h:outputText value="Enter firstname : " style="FONT-WEIGHT: bold;"/>    
                                 <h:inputText id="firstNamee" value="#{EmployeeMaster.firstName}" />
                                 <br/><br/>
                                                                                    
                                 <h:outputText value="Enter lastName : " style="FONT-WEIGHT: bold;"/>    
                                 <h:inputText id="lastNamee" value="#{EmployeeMaster.lastName}"  />
                                 <br/><br/>
                                                  
                                 <h:outputText value="Person Type :"  style="FONT-WEIGHT: bold;"/>         
                                 <h:selectOneMenu id ="personType" value="#{EmployeeDetailBean.personType}">
                                        <f:selectItem itemValue="ASE-T" itemLabel="ASE-T" />
                                        <f:selectItem itemValue="BA" itemLabel="BA" />
                                        <f:selectItem itemValue="Business Associate" itemLabel="Business Associate" />
                                        <f:selectItem itemValue="Employee" itemLabel="Employee" />
                                 </h:selectOneMenu>
                                 <br/><br/>
                             
                           </rich:panel>          
                    </td></tr></table></h:form> </body> </html>
      


      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_3_0.xsd" id="WebApp_ID" version="3.0">
          <display-name>roaster1</display-name>
          <welcome-file-list>
              <welcome-file>index.html</welcome-file>
              <welcome-file>index.htm</welcome-file>
              <welcome-file>index.jsp</welcome-file>
              <welcome-file>default.html</welcome-file>
              <welcome-file>default.htm</welcome-file>
              <welcome-file>default.jsp</welcome-file>
          </welcome-file-list>
          <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>/faces/*</url-pattern>
          </servlet-mapping>
          <context-param>
              <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
              <param-value>client</param-value>
          </context-param>
          <context-param>
              <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
              <param-value>resources.application</param-value>
          </context-param>
          <listener>
              <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
          </listener>
          <listener>
              <listener-class>org.com.init.Listener</listener-class>
          </listener>
      </web-app>
      

       

      Message was edited by: Brian Leathem I merged two threads by prepending the post from this thread https://community.jboss.org/thread/233112