13 Replies Latest reply on Mar 4, 2011 12:07 PM by ilya40umov

    Display list of values horizontally using rich:dataList

    sd1

      Hi, I'm new to JSF. Please help me with the following. I need to display values horizontally when I select an activity from drop down. The list of values should display in a single row, and these values vary. I am getting the results vertically.

       

      Here is the code:

       

      <rich:dataList value="#{ActivitySummaryBean.Activities}" var="activity">

                                       <h:panelGroup>

                                              <h:outputText value="#{activity.lane}"></h:outputText>

                                       </h:panelGroup>

       

                                  </rich:dataList>

       

      I need to get the output as:(these values will increase or decrease according to the activity selected)

       

      1  2  3  4  5 

       

      But Im getting

       

      1

      2

      3

      4

      5

       

      I also tried

      <ul>

          <ui:repeat items="#{ActivitySummaryBean.Activities}" var="activity">

              <li> <h:outputText value="#{activity.lane}"/></li>

          </ui:repeat>

      </ul>  

       

      but no luck

       

       

      Thanks

      sd

        • 1. Display list of values horizontally using rich:dataList
          boy18nj

          your best easy bet is, concatenate the values as string in your managed bean- activity.lane

          • 2. Display list of values horizontally using rich:dataList
            ilya40umov

            Use ui:repeat/a4j:repeat but without "<li>".

            Look at this example: http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_list_test

            • 3. Re: Display list of values horizontally using rich:dataList
              sd1

              Hi Aman,

               

              Thanks for the reply. I have to display an image for each number displayed hirizontally.like..and vales(numbers) change(increase or decrease) depending on the activity selected from the dropdown

               

              1          2           3

                             

               

              So I dont think Concatenation helps in this case, please let me know if im wrong.

               

              I have also used

              <h:dataTable id="dt2" value="#{ActivitySummaryBean.Activities}" var="activity"  >

               

                  <h:column>

                      <f:facet name="header">

                      <h:outputText value=" Id" />

                      </f:facet>

               

                      <h:outputText value="#{activity.lane}"/>

                  </h:column>

               

                  <h:column>

                      <h:graphicImage id="u-turn" value="../styles/icons/turn.gif" />

                  </h:column>

               

              </h:dataTable>

               

              Using h:datatable, the values/images are displaying vertically like:

               

               

               

               

               

              Thanks

              • 4. Re: Display list of values horizontally using rich:dataList
                sd1

                I tried without "<li>" , its still not working.

                • 5. Re: Display list of values horizontally using rich:dataList
                  ilya40umov

                  Please post the recent code with ui:repeat and result which is obtained in browser(html).

                  • 6. Re: Display list of values horizontally using rich:dataList
                    sd1

                    Here is the code,

                     

                    <ui:repeat items="#{ActivitySummaryBean.Activities}" var="activity">

                            <h:outputText value="#{activity.lane}"/>

                        </ui:repeat>

                     

                    webpage didnot display for this. it gave me http error.

                    • 7. Re: Display list of values horizontally using rich:dataList
                      ilya40umov

                      What kind of error?

                      • 8. Re: Display list of values horizontally using rich:dataList
                        sd1

                        This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

                        • 9. Re: Display list of values horizontally using rich:dataList
                          ilya40umov

                          =) I meant this: Could you provide the full stack trace of the exception?

                          • 10. Re: Display list of values horizontally using rich:dataList
                            sd1

                            Sorry,

                             

                            [3/4/11 10:29:05:610 EST] 00000023 WebApp        E   [Servlet Error]-[Faces Servlet]: com.sun.facelets.tag.TagException: /activitysummary/lane_activity_summary.jsp @63,81 <ui:repeat> Tag Library supports namespace: http://java.sun.com/jsf/facelets, but no tag was defined for name: repeat

                                at com.sun.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:155)

                                at com.sun.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:185)

                                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)

                                at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)

                                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

                                at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

                                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

                                at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

                                at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)

                                at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

                                at javax.xml.parsers.SAXParser.parse(SAXParser.java:379)

                                at javax.xml.parsers.SAXParser.parse(SAXParser.java:176)

                                at com.sun.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:222)

                                at com.sun.facelets.compiler.Compiler.compile(Compiler.java:105)

                                at com.sun.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:189)

                                at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:138)

                                at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:89)

                                at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:401)

                                at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:442)

                                at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)

                                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)

                                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)

                                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

                                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

                            • 11. Re: Display list of values horizontally using rich:dataList
                              ilya40umov

                              1) try a4j:repeat

                              2) probably you have old implementation of facelets. try facelets 1.1.15.B1

                              • 12. Re: Display list of values horizontally using rich:dataList
                                sd1

                                Hi I have used,

                                 

                                <a4j:repeat value="#{ActivitySummaryBean.Activities}" var="activity" >

                                           

                                                     <h:outputText  value="#{activity.lane}"></h:outputText>  

                                               

                                       </a4j:repeat>

                                 

                                i am not getting values in the page

                                • 13. Re: Display list of values horizontally using rich:dataList
                                  ilya40umov

                                  it's very strange.

                                  1) Provide your JSF/RF/Facelets versions

                                  2) What html code do you have in a browser for the following lines?

                                  <a4j:repeat value="#{ActivitySummaryBean.Activities}" var="activity" >

                                            

                                                       <h:outputText  value="#{activity.lane}"></h:outputText> 

                                                

                                         </a4j:repeat>