Results 1 to 2 of 2
  1. #1
    kaghamdi is offline Member
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0

    Default can't make ui:repeat work

    Hello

    I have a web app with ui:repeat and h:dataTable tags. the repeat tag does not work while dataTable works. what did I do wrong in here. see code below

    My index.xhtml has the following contens:

    = Start ============================
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br/> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"<br/> xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">


    <h1>Repeat Tag</h1>
    <ul>
    <ui:repeat var="color1" value="#{colorsBean.colors}">
    <li>#{color1}</li>
    </ui:repeat>
    </ul>

    <hr/>

    <h1>DataTable Tag</h1>
    <ul>
    <h:dataTable var="color2" value="#{colorsBean.colors}">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Color" />
    </f:facet>
    <h:outputText value="#{color2}"/>
    </h:column>
    </h:dataTable>
    </ul>
    </html>

    = End ============================



    ColorsBean is as follows:

    == Start ===========================
    public class ColorsBean {
    String []colors = new String[] {"White","Black","Freen","Blue","Red","Yellow","Cy an"};

    public String[] getColors() {
    return colors;
    }

    public void setColors(String[] colors) {
    this.colors = colors;
    }
    }
    = End ============================

    the libraries I have under WEB-INF/lib are:
    - jsf-api.jar
    - jsf-facelets-1.1.11.jar
    - jsf-impl.jar

    ==============================

    here is the page output:

    Repeat Tag
    --------------------------------------------------------------------------------
    DataTable Tag
    Color
    White
    Black
    Freen
    Blue
    Red
    Yellow
    Cyan

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. can't make ui:repeat work
    By kaghamdi in forum JavaServer Faces (JSF)
    Replies: 6
    Last Post: 12-31-2010, 11:43 AM
  2. Make it work !
    By PhQ in forum New To Java
    Replies: 6
    Last Post: 09-20-2010, 08:22 AM
  3. How do i make this work What am i doing Wrong.
    By Ramaan in forum New To Java
    Replies: 2
    Last Post: 03-01-2010, 11:36 PM
  4. Make the Button Work
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 1
    Last Post: 02-27-2010, 10:52 AM
  5. Can't make JTable work -- please help!!
    By cagalli83 in forum Advanced Java
    Replies: 0
    Last Post: 02-13-2008, 09:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •