10 Replies Latest reply on Sep 25, 2007 6:58 AM by kavi arasu

    using richface component in bean class

    kavi arasu Newbie

      hi im using
      rhdevstudio-win32-1.0.0.beta1
      and Copied "richfaces-api-3.1.0.jar" , "richfaces-impl-3.1.0.jar" , "richfaces-ui-3.1.0.jar" files into the "WEB-INF/lib" folder of my application which is created by using jboss-seam-2.0.0.CR1.
      but before there is no lib folder i created and put the jar files
      then i configured the web.xml file as by adding the following code

      <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
       <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>


      and in my bean i imported the

      import org.richfaces.component.html.HtmlTabPanel;
      HtmlTabPanel myTabPanel = new HtmlTabPanel();
      myTabPanel.getActiveTabClass();


      everthing is working in it
      but when i built it not building and giving me error

      Caused by: java.lang.NoClassDefFoundError: Lorg/richfaces/component/html/HtmlTabPanel;
       at java.lang.Class.getDeclaredFields0(Native Method)
       at java.lang.Class.privateGetDeclaredFields(Unknown Source)
       at java.lang.Class.getDeclaredFields(Unknown Source)
       at org.jboss.seam.Component.initMembers(Component.java:547)
       at org.jboss.seam.Component.<init>(Component.java:250)
       at org.jboss.seam.Component.<init>(Component.java:214)
       at org.jboss.seam.init.Initialization.addComponent(Initialization.java:940)
       ... 94 more
      18:23:02,968 ERROR [StandardContext] Error listenerStart
      18:23:02,968 ERROR [StandardContext] Context [/finalproject] startup failed due to previous errors
      18:23:03,109 WARN [ServiceController] Problem starting service jboss.web.deployment:war=finalproject.war,id=359069193


      thank u regards
      Kaviarasu




        • 1. Re: using richface component in bean class
          Maksim Kaszynski Apprentice

          Looks like there is another (older) version of Richfaces in your classpath.

          • 2. Re: using richface component in bean class
            kavi arasu Newbie

            Hi
            i searched for any older version of rich face component in my project
            i cant find any
            can u say how to over come this problem
            and how to set new calss path to this new rich face components
            and or any other method available to find the active tab in <rich:tabPanel>
            thank u regards
            kaviarasu

            • 3. Re: using richface component in bean class
              Maksim Kaszynski Apprentice

               

              "kaviarasu" wrote:
              Hi
              i searched for any older version of rich face component in my project
              i cant find any
              can u say how to over come this problem
              and how to set new calss path to this new rich face components
              and or any other method available to find the active tab in <rich:tabPanel>
              thank u regards
              kaviarasu


              1) If you use jboss as, it may share libs between applications, so take a look in deployment directory.
              2) There's selectedTab attribute in tabPanel - you may use it to get/set selected tab.

              • 4. Re: using richface component in bean class
                kavi arasu Newbie

                hi im using redhatdeveloper studio which has a built in jboss as
                im having only this project in the server
                and serched the whole server
                so i get only three files in it name

                D:\rhdevstudio\jboss-eap\jboss-as\server\default\deploy\finalproject.ear\finalproject.war\WEB-INF\lib\richfaces-impl-3.1.0.jar

                D:\rhdevstudio\jboss-eap\jboss-as\server\default\deploy\finalproject.ear\finalproject.war\WEB-INF\lib\richfaces-ui-3.1.0.jar
                and

                D:\rhdevstudio\jboss-eap\jboss-as\server\default\deploy\finalproject.ear\lib\richfaces-api-3.1.0.jar

                where finalproject is my project name.

                i cant find any other richfaces version there

                There are five tab in my page.
                when the user in third page some links are shown .
                when the user click the link it take to other page. when a back button is pressed there it come to this previous page.so i want to store the current tab which the user previous visited.
                if i use set tab for third tab it opens third tab default. but i want to set dynamic. the tab selected for each time differ.

                so i want to set the seleted tab in bean and get the tab when he again visit the page. for that im trying to import richface .component and
                HtmlTabPanel myTabPanel = new HtmlTabPanel(); and get the active tab
                myTabPanel.getActiveTabClass();

                thank u
                regards
                kaviarasu

                • 5. Re: using richface component in bean class
                  Ilya Shaikovsky Master

                  having

                  <rich:tabPanel switchType="client" id="tab" binding="#{bean.tabPanel}">
                  ...
                  <a4j:commandButton value="print" action="#{bean.action}"></a4j:commandButton>
                  


                  and

                  import org.richfaces.component.html.HtmlTabPanel;
                  ...
                  System.out.println(getTabPanel().getSelectedTab().toString());
                  


                  have no problems under 3.1.1 version..

                  And B.t.w why you use binding.. why you can't just point selectedTab attribute to some dynamic property?

                  • 6. Re: using richface component in bean class
                    kavi arasu Newbie

                    hi i used the same script u used and create a getter method

                    UITabPanel tabPanel;
                    
                     private UITabPanel getTabPanel() {
                     return tabPanel;
                     }

                    but im getting the error

                    Caused by: java.lang.NoClassDefFoundError: org/richfaces/component/UITabPanel


                    here what u mean by setting to dynamic property

                    and now i didnt configure my web.xml file
                    just i add path the jars using right click my project in package explorer and click buld path and configure build path after that i added the jars.
                    then only i can able to import the richface package.
                    but still giving the error
                    thanks for ur response
                    how to solve the problem
                    once again i thank u
                    regards
                    kaviarasu

                    • 7. Re: using richface component in bean class
                      Ilya Shaikovsky Master

                      "and now i didnt configure my web.xml file "

                      what do you mean?

                      • 8. Re: using richface component in bean class
                        kavi arasu Newbie

                        First i copied "richfaces-api-3.1.0.jar" , "richfaces-impl-3.1.0.jar" , "richfaces-ui-3.1.0.jar" files into the "WEB-INF/lib" folder of my application which is created by using jboss-seam-2.0.0.CR1 .
                        but before there is no lib folder i created and put the jar files
                        then i configured the web.xml file as by adding the following code


                        <context-param>
                         <param-name>org.richfaces.SKIN</param-name>
                         <param-value>blueSky</param-value>
                         </context-param>
                         <filter>
                         <display-name>RichFaces Filter</display-name>
                         <filter-name>richfaces</filter-name>
                         <filter-class>org.ajax4jsf.Filter</filter-class>
                         </filter>
                         <filter-mapping>
                         <filter-name>richfaces</filter-name>
                         <servlet-name>Faces Servlet</servlet-name>
                         <dispatcher>REQUEST</dispatcher>
                         <dispatcher>FORWARD</dispatcher>
                         <dispatcher>INCLUDE</dispatcher>
                         </filter-mapping>


                        now i removed these congiguration in web.xml file and add the jars to the project using build path

                        ragrds
                        kavi


                        • 9. Re: using richface component in bean class
                          Ilya Shaikovsky Master

                          you need this filter to be defined in web.xml

                          • 10. Re: using richface component in bean class
                            kavi arasu Newbie

                            hi i again configure the web.xml file and grtting the same error

                            Caused by: java.lang.NoClassDefFoundError: org/richfaces/component/UITabPanel
                             at java.lang.Class.getDeclaredMethods0(Native Method)
                             at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
                             at java.lang.Class.getDeclaredMethods(Unknown Source)
                             at org.jboss.seam.Component.initMembers(Component.java:542)
                             at org.jboss.seam.Component.<init>(Component.java:250)
                             at org.jboss.seam.Component.<init>(Component.java:214)
                             at org.jboss.seam.init.Initialization.addComponent(Initialization.java:940)
                             ... 139 more
                            16:20:14,156 ERROR [StandardContext] Error listenerStart
                            16:20:14,156 ERROR [StandardContext] Context [/finalproject] startup failed due to previous errors
                            16:20:14,312 WARN [ServiceController] Problem starting service jboss.web.deployment:war=finalproject.war,id=359069193
                            org.jboss.deployment.DeploymentException: URL file:/D:/rhdevstudio/jboss-eap/jboss-as/server/default/deploy/finalproject.ear/finalproject.war/ deployment failed


                            my code is

                            import org.richfaces.component.UITabPanel;
                            import org.richfaces.component.html.HtmlTabPanel;
                            import org.richfaces.component.UITabPanel;
                            import org.ajax4jsf.*;
                            
                            ....
                             private UITabPanel getTabPanel() {
                             return null;
                            }
                            
                             @Begin(join=true)
                             public void selectFromRequest() {
                             System.out.println(getTabPanel().getSelectedTab().toString());
                            }


                            thank u for ur reply
                            regrds
                            kavi