3 Replies Latest reply on Oct 14, 2011 3:01 AM by Ranveer Singh

    Richfaces Themes not working if code generated dynamically from java

    Ranveer Singh Newbie

      I am trying to generate the rich:panelMenu from java code. If i use xhtml for rich:panelMenu it is working but if generate the same from java skining not working. I debugged through firebug and found different behavior.

       

      If i am writing the code in xhtml , following are the documents getting loaded in head tag.

       

      <link href="/ims1/javax.faces.resource/layout.css.jsf?ln=css" rel="stylesheet" type="text/css">

      </link>

       

      <script src="/ims1/javax.faces.resource/jsf.js.jsf?ln=javax.faces&stage=Development" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/jquery.js.jsf" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/richfaces.js.jsf" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/richfaces-queue.js.jsf" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/richfaces-event.js.jsf" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/richfaces-base-component.js.jsf" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/panelMenu.js.jsf?ln=org.richfaces" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/panelMenuItem.js.jsf?ln=org.richfaces" type="text/javascript">

      </script>

       

      <script src="/ims1/javax.faces.resource/panelMenuGroup.js.jsf?ln=org.richfaces" type="text/javascript">

      </script>

       

      <link href="/ims1/rfRes/icons.ecss.jsf?db=eAHzX7!yOgAFdgJ!&ln=org.richfaces" rel="stylesheet" type="text/css">

      </link>

       

      <link href="/ims1/rfRes/panelMenu.ecss.jsf?db=eAHzX7!yOgAFdgJ!&ln=org.richfaces" rel="stylesheet" type="text/css">

      </link>

      </head>

       

      If i use java cod eto generate then only following get loaded

       

      <link href="/ims1/javax.faces.resource/layout.css.jsf?ln=css" rel="stylesheet" type="text/css">

      </link>

       

      In addition to this, i have use layout.css for layout purpose but that is also not working.

        • 1. Re: Richfaces Themes not working if code generated dynamically from java
          Ranveer Singh Newbie

          Forgot to add, I am using richfaces4 and JSF2.0 and web.xml is as follows..

          <?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>ims1</display-name>

              <context-param>

                  <param-name>org.richfaces.skin</param-name>

                  <param-value>classic</param-value>

              </context-param>

              <context-param>

                  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

                  <param-value>server</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>org.richfaces.enableControlSkinning</param-name>

                  <param-value>false</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>*.jsf</url-pattern>

                  <url-pattern>/faces/*</url-pattern>

              </servlet-mapping>

              <mime-mapping>

                  <extension>xcss</extension>

                  <mime-type>text/css</mime-type>

              </mime-mapping>

              <welcome-file-list>

           

                  <welcome-file>index.jsp</welcome-file>

           

              </welcome-file-list>

          </web-app>

          • 2. Re: Richfaces Themes not working if code generated dynamically from java
            Ranveer Singh Newbie

            I am adding the navigation xml, i am using. This code is working fine.

            <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"

                >

               

                <rich:panelMenu>

                            <rich:panelMenuGroup label="Home">

                                <rich:panelMenuItem/>

                               

                            </rich:panelMenuGroup>

                            <rich:panelMenuGroup label="Academics">

                                <rich:panelMenuItem label="Semester"/>

                                <rich:panelMenuItem label="Section/Class"/>

                                <rich:panelMenuItem label="Batch Detail"/>

                                <rich:panelMenuItem label="Subject Detail"/>

                                <rich:panelMenuItem label="Syllabus/Weightage"/>

                                <rich:panelMenuItem label="Curriculum"/>

                            </rich:panelMenuGroup>

                           

                        </rich:panelMenu>

               

               

            </ui:composition>

             

            ########################This code is not working #######################

             

            I am generating the panelMenu through the java code. When i am trying to generate through javacode firebug is throwing error Richfaces not found

            and i found that taglibs are getting ignored. Please help i am completely stuck with this. I have used richfaces 3.3 in same fashion and there were no problems.

             

            <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"

                >

               

                <rich:panelMenu binding="#{componentNavigator.panelMenu}" />

               

            </ui:composition>

            • 3. Re: Richfaces Themes not working if code generated dynamically from java
              Ranveer Singh Newbie

              Please follow the given thread.

              Before that just wanted to brief the solution. Problem was the way i was using creating the UIPanel. I was using

              UIPanel panel = new UIPanel();

              but it should be used like given below,

               

              FacesContext ctx = FacesContext.getCurrentInstance();

                      UIPanelMenu panelMenu = (UIPanelMenu)ctx.

                      getApplication().createComponent(ctx,UIPanelMenu.COMPONENT_TYPE,"org.richfaces.PanelMenuRenderer");

               

              This works fine in Request Scope but still has some issue with Session Scope. Please go to  the below thread for discussion, otherwise it will be duplicate discussion.

               

              http://community.jboss.org/message/593193