Results 1 to 6 of 6
  1. #1
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default How to display item or string many times in JSF

    Hello,

    i wish to get the way to get JSF code similar to the Following Java code:

    Java Code:
    for(int i = 0; i > 5; i++){
    System.out.println("welcome");
    }

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,843
    Rep Power
    5

    Default Re: How to display item or string many times in JSF

    Come on dude, get a good book or google "java JSF repeat".
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default Re: How to display item or string many times in JSF

    i did, there are tones of exampels but they are all just about how to iterate array or arraylist not as my case...so any help?

  4. #4
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,843
    Rep Power
    5

    Default Re: How to display item or string many times in JSF

    When I do that exact Google search the first three hits talk about ui:repeat.

    But I don't agree with your statement that iterating an arraylist is not your case - yes it does apply to you too, its another solution to the same problem.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default Re: How to display item or string many times in JSF

    If i have the following method in my java bean

    Java Code:
    public final int getWbCount() {
    return 5;
    }
    And i want to print "welcome" 5 times from JSF files
    By using JSF repeat:
    Java Code:
    <ui:repeat value="#{dictionary.wbCount}" var="a">
                Welcome
    </ui:repeat>
    but it pritned "welcome" just one time

    where is my error?

  6. #6
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,843
    Rep Power
    5

    Default Re: How to display item or string many times in JSF

    Because wbCount is not an arraylist holding five instances of the String "welcome".

    Further reading if you must keep making your life so difficult by not properly studying JSF. What other JSF tags are available that relate to looping. Another simple google search:

    "java jsf loop"
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 8
    Last Post: 04-28-2014, 05:56 PM
  2. Replies: 1
    Last Post: 06-29-2011, 02:32 PM
  3. Why wont my JSP page display my selected item?
    By system32 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-01-2011, 04:02 PM
  4. Replies: 0
    Last Post: 02-25-2010, 12:51 PM
  5. Extract item from a string
    By firewalll in forum New To Java
    Replies: 2
    Last Post: 09-02-2009, 05:00 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
  •