9 Replies Latest reply: Sep 18, 2013 9:15 AM by 1037986 RSS

    Databound Carousel spin not refreshing data




      We are using JDeveloper


      On left part of page, we want to show carousel component showing photos of employees (fetched from PER_IMAGES.IMAGE BLOB column).

      On right hand side, we want to show details of employee shown in carousel.


      We referred Oracle documentation "32.3.1 How to Create a Databound Carousel Component":

      Using More Complex Databound ADF Faces Components - 11g Release 2 (

      When we run the page it shows first record. However carousel spin does not refresh employee details to show subsequent employees.

      Also employee image is also not shown.


      Any help/suggestion in this regard is appreciated.



        • 1. Re: Databound Carousel spin not refreshing data
          Timo Hahn

          Question is how you setup the carousel and the images?  The sample uses an url for the images so I guess they are referring to static data.  If you want to use blobs the Dame way you can use the approach from my blog http://wp.me/pcBZk-bU



          • 2. Re: Databound Carousel spin not refreshing data

            Hi Timo,


            Thanks for helping me showing employee image from DB into the carousel. I had missed creating JDBC data source in the WLS Console.


            I would really appreciate if you can help us with the other issue as well:

            When we run the page it shows first record. However carousel spin does not refresh employee details to show subsequent employees.




            • 3. Re: Databound Carousel spin not refreshing data
              Timo Hahn

              Adf a partial trigger to the form pointing to the carousel.  This should update the detail.



              • 4. Re: Databound Carousel spin not refreshing data

                Hi Timo,


                2nd issue is also resolved

                I had set partial trigger.. but there was small issue in Carousel spin handler method (in managed bean).


                There is still a small issue..

                After carousel spin, although the form shows next employee, employee image in carousel is not refreshed. It still shows the first employee image.

                Any idea how to refresh employee image on carousel spin?


                I tried setting partial trigger on image.. but it does not work.


                (I can share ImageServlet and handleCarouselSpin code, if you want me to.)




                • 5. Re: Databound Carousel spin not refreshing data

                  Hi Timo and other ADF experts,


                  Please help us  resolve the issue with refreshing carousel image on carousel spin.

                  Do we need to explicitly call ImageServlet on carousel spin? Or can it be set to called automatically (e.g. using PPR)?




                  • 6. Re: Databound Carousel spin not refreshing data
                    Timo Hahn

                    Please post the carousel code, so that we see how the image url looks like and the code you use to handle the spin.



                    • 7. Re: Databound Carousel spin not refreshing data

                      The carousel code (XML) is as follows:


                      <af:carousel currentItemKey="#{bindings.EmpDetailsVO1.treeModel.rootCurrencyRowKey}"

                                                                               value="#{bindings.EmpDetailsVO1.treeModel}" var="item" id="c1"



                                                                      <f:facet name="nodeStamp">

                                                                          <af:carouselItem id="ci1" text="#{bindings.FullName}"











                      CarouselBean.handleCarouselSpin() code:


                          public void handleCarouselSpin(CarouselSpinEvent carouselSpinEvent)



                            //get the selected item key - an instance of java.util.List

                            List currentSelectedKey = (List) carouselSpinEvent.getNewItemKey();


                            //get a handle to the carousel component instance. We need this to

                            //generically access the binding layer

                            RichCarousel carousel = (RichCarousel) carouselSpinEvent.getSource();


                            //get the Trinidad CollectionModel for this component

                            CollectionModel componentModel = (CollectionModel) carousel.getValue();


                            //get the ADF tree binding from the CollectionModel. This code also

                            //works with tables and trees and thus is worth to remember

                            JUCtrlHierBinding carouselTreeBinding = (JUCtrlHierBinding) componentModel.getWrappedData();


                            //get the selected node

                            JUCtrlHierNodeBinding selectedCarouselItemNode = carouselTreeBinding.findNodeByKeyPath(currentSelectedKey);


                            //get the row key to make it the current key in the ADF iterator

                            Key currentCarouselItemKey = selectedCarouselItemNode.getRowKey();

                            //You can access the iterator binding from the tree binding so that

                            //you don't need any knowledge about the namings in the PageDef file

                            DCIteratorBinding dcIterBinding = carouselTreeBinding.getIteratorBinding();


                            //make the row the current row

                            dcIterBinding.setCurrentRowWithKey (currentCarouselItemKey.toStringFormat(true));




                      ImageServlet.doGet() code:


                          public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                              String detailPersonId = request.getParameter("id");

                              String thumbnailPersonId = request.getParameter("thumbnail");
                              boolean thumbnail = true;
                              String personId = null;

                              OutputStream os = response.getOutputStream();
                              Connection conn = null;

                              try {
                                  Context ctx = new InitialContext();
                                  DataSource ds = (DataSource)ctx.lookup("jdbc/Stephano");

                                  conn = ds.getConnection();
                                  PreparedStatement statement =
                                      conn.prepareStatement("SELECT pi.image FROM per_all_people_f ppf, per_images pi " +
                                          "WHERE ppf.business_group_id = 202 AND pi.parent_id = ppf.person_id " +
                                          "AND pi.table_name = 'PER_PEOPLE_F' AND sysdate BETWEEN ppf.effective_start_date AND ppf.effective_end_date " +
                                          "AND ppf.person_id = ?");

                                  if (detailPersonId != null) {

                                      personId = detailPersonId;
                                      thumbnail = false;

                                  } else {
                                      personId = thumbnailPersonId;


                                  statement.setInt(1, new Integer(personId));
                                  ResultSet rs = statement.executeQuery();

                                  if (rs.next()) {
                                      Blob blob = rs.getBlob("IMAGE");

                                      BufferedInputStream in = new BufferedInputStream(blob.getBinaryStream());
                                      int b;
                                      byte[] buffer = new byte[10240];

                                      while ((b = in.read(buffer, 0, 10240)) != -1) {
                                          os.write(buffer, 0, b);

                              } catch (Exception e) {

                              } finally {
                                  try {
                                      if (conn != null) {


                                  } catch (SQLException sqle) {






                      • 8. Re: Databound Carousel spin not refreshing data
                        Timo Hahn

                        Looks like your carousel mark upis not correct.  Look at the code below

                        <af:carousel id="c1"



                                                   var="item" orientation="horizontal"


                                        <f:facet name="nodeStamp">

                                          <af:carouselItem id="ci1">

                                            <af:image source="/imageservlet?id=#{item.ImageId}"

                                                      shortDesc="#{item.ImageDescription}" id="i1"/>




                        Add you see the image id is read from the var property "item" and not from the current dejected row.

                        Change your code in a way that you use the item instead of the binding.



                        • 9. Re: Databound Carousel spin not refreshing data

                          Thanks so much Timo! After passing the id from "item" property (instead of normal data bindings), image is correctly refreshing on carousel spin.