7 Replies Latest reply on Jun 2, 2011 12:40 AM by Vikas V

    What is #{pic.uri} in SlidesBean?

    Vikas V Newbie

      Hi,

       

       

      I was trying dataScroller API example provided in Rich faces showcase demo site.

       

      <a4j:repeat rows="3" value="#{slidesBean.pictures}" var="pic" 

                          id="pics">

                          <h:graphicImage value="#{pic.uri}" style="" width="175" alt="uri"/>

      </a4j:repeat>

       

       

      What is uri here?

       

      Am getting below exception after running the code,

       

       

      java.lang.IllegalArgumentException: null source

      Regards,

        • 1. Re: What is #{pic.uri} in SlidesBean?
          Kike Gil Novice

          pic.uri is the url of the image from bean

          • 2. Re: What is #{pic.uri} in SlidesBean?
            Vikas V Newbie

            Below is the bean contents and I coulnt find uri in that,

             

             

            Not sure if below bean is the one which is used in that showcase.

             

             

            package org.richfaces.demo.slides;

            import java.util.ArrayList;
            import java.util.List;

            /**
            * @author Ilya Shaikovsky
            *
            */

            public class SlidesBean {
               
                private final static String FILE_EXT = ".jpg";
                private final static int FILES_COUNT = 9;
                private final static String PATH_PREFIX = "/richfaces/jQuery/images/";
                private final static String PIC_NAME = "pic";
               
                private List<String> pictures;
                private int currentIndex = 1;
               
                public SlidesBean() {
                    pictures = new ArrayList<String>();
                    for (int i = 1; i <= FILES_COUNT; i++) {
                        pictures.add(PATH_PREFIX + PIC_NAME + i + FILE_EXT);
                    }
                }
               
                public void next() {
                    if (currentIndex<FILES_COUNT) {
                        currentIndex++;
                    }else{
                        setCurrentIndex(1);
                    }
                }

                public void previous() {
                    if (currentIndex>1) {
                        currentIndex--;
                    }else
                    {
                        setCurrentIndex(FILES_COUNT);
                    }
                }

                public List<String> getPictures() {
                    return pictures;
                }

                public void setPictures(List<String> pictures) {
                    this.pictures = pictures;
                }

                public int getCurrentIndex() {
                    return currentIndex;
                }

                public void setCurrentIndex(int currentIndex) {
                    this.currentIndex = currentIndex;
                }
               
                public String getCurrentPicture() {
                    return pictures.get(currentIndex-1);
                }

                public static String getFILE_EXT() {
                    return FILE_EXT;
                }

                public static int getFILES_COUNT() {
                    return FILES_COUNT;
                }

                public static String getPATH_PREFIX() {
                    return PATH_PREFIX;
                }

                public static String getPIC_NAME() {
                    return PIC_NAME;
                }
            }

            • 3. Re: What is #{pic.uri} in SlidesBean?
              Kike Gil Novice

              i understand the bean but i dont unserstand why use #{pic.uri} because pic is a string value.

               

              try use only #{pic}.

               

              really pic is ""/richfaces/jQuery/images/pic.jpg", and , a4j:repeat  do 9 times

              • 4. Re: What is #{pic.uri} in SlidesBean?
                Vikas V Newbie

                No luck

                • 5. Re: What is #{pic.uri} in SlidesBean?
                  Nick Belaevski Master

                  What does #{slidesBean} prints?

                  • 6. Re: What is #{pic.uri} in SlidesBean?
                    Vikas V Newbie

                    It prints,

                     

                    java.lang.IllegalArgumentException: could not find dataTable with id 'pics'
                         at org.richfaces.DataScrollerUtils.findDataTable(DataScrollerUtils.java:119)
                         at org.richfaces.component.AbstractDataScroller.getDataTable(AbstractDataScroller.java:194)
                         at org.richfaces.event.DataTablePreRenderListener.processEvent(DataTablePreRenderListener.java:120)
                         at javax.faces.event.SystemEvent.processListener(SystemEvent.java:102)
                         at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2040)
                         at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2016)
                         at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:298)
                         at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:242)
                         at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:816)
                         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:298)
                         at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:181)
                         at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:125)
                         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
                    

                     

                    Regards,

                    • 7. Re: What is #{pic.uri} in SlidesBean?
                      Vikas V Newbie

                      Hi,

                       

                      Even if (by luck) am able to get the above code working , using rich:dataScroller API if I would like to display 3 images per page and totally there are 5 images then it will display 3 images first and then it will  display 2 images and a blank when I click on right scroller!!

                       

                      How to get rid of this blank?

                       

                      Regards,