1 2 Previous Next 17 Replies Latest reply on Apr 8, 2010 2:24 PM by jabailo

    Richfaces datatable will not call bean or render data

    jabailo

      I developed a java bean that will produce a List of users from an ldap server.

       

      I am able to display the data in a jsf table if I use the html library for jsf.   However, when I switch to using richfaces, it doesn't seem to fire up the .users method on the same bean and no data is rendered.   In both cases the page renders without error, but in the second, there is no data in the data grid.

       

      This version works:

       

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

       

      <h:dataTable value="#{userBean2.users}" var="user"
                  bgcolor="#F1F1F1" border="10" cellpadding="5"
                  cellspacing="3" first="0"  width="50%"
                  dir="LTR" frame="hsides" rules="all"
                  summary="This is a JSF code to create dataTable." >
              <h:column>
                   <h:outputText id="name" value="#{user.name}"/>
              </h:column>
              <h:column>
                   <h:outputText id="email" value="#{user.email}"/>
              </h:column>
         </h:dataTable>

       

       

      This version does not work:

       

      <!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:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">



         <rich:dataTable value="#{userBean.users}" var="user">
          <h:column>
           <h:outputText id="name" value="#{user.name}"/>
          </h:column>
          <h:column>
           <h:outputText id="email" value="#{user.email}"/>
          </h:column>
         </rich:dataTable>


        • 1. Re: Richfaces datatable will not call bean or render data
          ilya_shaikovsky

          checked and has no problem with such definition. anything in the log? RF version?

          • 2. Re: Richfaces datatable will not call bean or render data
            jabailo

            I tried a different approach.   I created a base jsp page with the core jsf taglibs.

             

            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

             

            Then, using Eclipse, I dragged and dropped a JBoss RichFaces dataTable from the JBoss Tools Palette.

             

            At that point it added a new taglib:

             

            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

             

            However, that taglib has an error highlight that says:

             

            Cannot find the tag library descriptor for http://richfaces.org/rich

             

            I tried bringing up the url in a browser and it takes me to the JBoss Community RichFaces page.

            • 3. Re: Richfaces datatable will not call bean or render data
              nbelaevski

              Hi John,

               

              Please check that RichFaces .jar files (three files) are present in application classpath together with commons-* dependencies (four .jar files for logging, collections, digester, beanutils).

              • 4. Re: Richfaces datatable will not call bean or render data
                jabailo

                The commons dependencies are in my Web App Libraries, but the RichFaces jars are not.

                 

                Do I need to explicitly add them to my Java Build Path libraries?

                • 5. Re: Richfaces datatable will not call bean or render data
                  nbelaevski

                  Yes, try adding them there.

                  • 6. Re: Richfaces datatable will not call bean or render data
                    jabailo

                    The three richfaces jars now appear in the Referenced Libraries folder of my project.

                     

                    However, the datatable still does not render.

                     

                     

                    I notice one error message in the Console when I run my .jsp page:

                     

                    13:51:42,291 INFO [STDOUT] 13:51:42,291 ERROR [MyfacesConfig]

                    Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.

                     

                     

                    Should I delete MyFaces jars?

                    • 7. Re: Richfaces datatable will not call bean or render data
                      jabailo

                      I started a jsp page from scratch.

                       

                      This time, I am offered the chance to add the RichFaces libs to the .jsp so I assume the jars are now recognized.

                       

                      However, when running the page, this error appears:

                       

                      org.apache.jasper.JasperException: The absolute uri: http://richfaces.org/rich cannot be resolved in either web.xml or the jar files deployed with this application

                       

                      This is what the page looks like:

                       

                      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
                      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
                      <html>
                          <head>
                              <title></title>
                          </head>
                          <body>
                         
                          <f:view>       
                          <rich:dataTable value="#{userBean2.users}" var="user">
                              <h:column>
                                   <h:outputText id="name" value="#{user.name}"/>
                              </h:column>
                              <h:column>
                                   <h:outputText id="email" value="#{user.email}"/>
                              </h:column>
                          </rich:dataTable>
                          </f:view>
                          </body>   
                      </html>

                      • 8. Re: Richfaces datatable will not call bean or render data
                        jabailo

                        Ok, I got it working -- thanks for everyone's help for being such a noo3.

                         

                        My confusion came from thinking that by using the Eclipse/JBoss preconfigured version that RichFaces would be there for me (also seeing the controls in the Toolbox).   That appears not to be the case, and I still have to manually configure.  

                         

                        I followed these instructions to the letter:

                         

                        http://docs.jboss.org/richfaces/latest_3.3.X/en/devguide/html_single/#GettingStarted

                         

                        And now my RichFaces dataTable renders from the bean.

                        • 9. Re: Richfaces datatable will not call bean or render data
                          jabailo

                          Well, I have an update and it's not good news.

                           

                          After further inspection, I wasn't actually running the RichFaces page in my project.   It still did not work correctly.

                           

                          I went back and created a brand new project with JBoss tools.

                           

                          I found there is an option for JSF project that includes the RI libs (which appear to be part of JBoss 4.3.2). 

                           

                          However, even as a shell project the initial page failed to deploy and it broke deployment of other projects!!

                           

                          My reading seems to indicate that there is just something broken with RichFaces and JBoss prior to 5.x -- whatever it is, it certainly isn't a trivial configuration.

                           

                          So, I went back to what has worked for me, Tomahawk MyFaces.  I find that they have not only a dataTable but a modalPopup -- the two controls I needed.   Seems to work just fine.

                          • 10. Re: Richfaces datatable will not call bean or render data
                            nbelaevski

                            Hi,

                             

                            That's strange because I was successfully running several RichFaces applications at JBoss 4.3 simultaneously. Can you please provide more information on broken deployments?

                            • 11. Re: Richfaces datatable will not call bean or render data
                              jabailo

                              I am more than willing to post those from my server logs, but since yours works, can you tell me:

                               

                               

                              1.  Are you using JBoss tools with Eclipse?

                              2.  What project type are you using?

                              3.  What template options are you using?   Did you select Facelets with RI Libs?

                              4.  Are you using xhtml or jsp pages for your RichFaces dataTable?   Are you using a managed bean to populate?

                              5.  When you create your jsp page, what taglib options do you select?

                              6.  What addiitonal jar did you add to your project?    Did you put them in WEF-INF/lib ?    Did you have to remove any JBoss built in jars from your classpath?   If so, how did you do this?

                              7.  Did you follow any guide or set of instructions or tutorial for getting your JSF/Facelets/RichFaces dataTable to work with a managed Bean?  Do you have a hyperlink?

                              • 12. Re: Richfaces datatable will not call bean or render data
                                ilya_shaikovsky

                                It seems for me that all the problems just in configuration of the projects. http://docs.jboss.org/tools/movies/demos/rich_faces_demo/rich_faces_demo.htm screencast about simple JSF-RF project creation using tools. It uses JSP but after you will sucsessfully check that it works I highly recommnend to switch to facelets.

                                 

                                 

                                However, even as a shell project the initial page failed to deploy and it broke deployment of other projects!!

                                about all such problems - there are should be exceptions at server log on server startup. You should carefully check them and investigate the reasons. If you not find out the problem but solved it by just implementations switching - ti seems like just a hack and some (probably other) configuration problems wil re-appear in future. All our test applications switches between myFaces and JSF RI smoothly and supports deployments to different app servers (sometimes some dependencies or configuration changes required for concrete server). So JSF implementation should not be the reason for sure.

                                • 13. Re: Richfaces datatable will not call bean or render data
                                  jabailo

                                  Thanks for all the help.

                                   

                                  The link you provide is for JBoss Developer Studio.

                                   

                                  But I found this article about configuring Eclipse for JBoss Richfaces, JSF...

                                   

                                  http://giantflyingsaucer.com/blog/?p=723

                                   

                                  All thought they are using Tomcat 6.0, not JBoss 4.2.3

                                  • 14. Re: Richfaces datatable will not call bean or render data
                                    nbelaevski

                                    Well, I mostly work with Maven-based WAR projects that use Facelets and I've started using JBT recently (previously used WTP + the hint from Dan Allen: http://goo.gl/JN9B ), so can't give much help for it, sorry.

                                     

                                    Types of beans: either managed beans or Seam components, also Spring beans (rarely).

                                     

                                    On the list of necessary libs: I recommend to stick to Maven (that handles dependencies automatically). Anyway, the following is necessary for JBoss 4.3:

                                     

                                    - four commons-*

                                    - RF api, impl, ui (EAR layout has some specifics - checks docs if you need it)

                                     

                                    For optimal performance:

                                     

                                    - Neko HTML + dependencies (Xerces) - 

                                     

                                    JBoss 4.3 comes with JSF, so you don't have to bundle it.

                                     

                                    If you want to use MyFaces, check this article please: http://community.jboss.org/wiki/JBoss5AndMyFaces

                                    1 2 Previous Next