Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8386427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:56:08+00:00 2026-06-09T17:56:08+00:00

We’ve got a web application built on JBoss 7.1 with JSF2 and Primefaces 3.3.

  • 0

We’ve got a web application built on JBoss 7.1 with JSF2 and Primefaces 3.3.

On one of our page, there is a ui:repeat displaying 10 items; then the user can click on some kind of “show more” button and 10 more items are displayed through ajax. The user can click the “show more” button until there is no more items to show. Note: This is not pagination, the displayed list gets longer with each click on “show more”.

In fact, when the user clicks on the button, the server returns the old items and the new ones, and the client side of JSF must rebuild the whole repeater through jQuery each time.

We would like to find a better and more performant solution. The old items don’t change between the n-1 and the n call, so it would be more efficient if the server could only return through ajax the 10 new items.

Is it possible in JSF2 ? JSF seems not really compliant with this kind of recursive rendering. The only component that maybe could help us would be a TreeNode component, but it seems a bit of a hack :-/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:56:10+00:00Added an answer on June 9, 2026 at 5:56 pm

    There’s nothing like that in the standard JSF API. Also nothing comes to mind in PrimeFaces. For PrimeFaces see the update at the end

    The OmniFaces <o:componentIdParam> may however be exactly what you’re looking for. It allows you to let JSF render only a subset of the component tree based on a specific request parameter, which can be a component ID or a client ID. You could basically just use jQuery’s $.get() to reload the <ui:repeat> along with the start index as a request parameter and use jQuery’s $.append() to append it to the HTML DOM.

    Here’s a complete kickoff example. The view:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:o="http://omnifaces.org/ui"
    >
        <f:metadata>
            <o:componentIdParam componentIdName="componentId" />
        </f:metadata>
        <h:head>
            <title>Stack Overflow Question 11364006</title>
            <script src="http://code.jquery.com/jquery-latest.min.js"></script> <!-- Substitute with PrimeFaces' one, if necessary. -->
        </h:head>
        <h:body>
            <ul id="items">
                <ui:repeat id="itemsRepeater" value="#{bean.items}" var="item">
                    <li>#{item}</li>
                </ui:repeat>
            </ul>
            <input type="button" id="showMore" value="Show more"/>
            <h:outputScript>
                $("#showMore").click(function() {
                    $items = $("#items");
                    var params = { start: $items.find("li").length, componentId: "itemsRepeater" };
                    $.get(location, params, function(html) {
                        $items.append(html);
                    });
                });
            </h:outputScript>   
        </h:body>
    </html>
    

    The backing bean:

    @ManagedBean
    @RequestScoped
    public class Bean {
    
        private List<String> items;
    
        @ManagedProperty("#{param.start}")
        private int start;
    
        @PostConstruct
        public void init() {
            // Just a stub. Do your thing to fill the items.
            items = new ArrayList<String>();
            int size = start + 10;
    
            for (int i = start; i < size; i++) {
                items.add("item " + (i + 1));
            }
        }
    
        public void setStart(int start) {
            this.start = start;
        }
    
        public List<String> getItems() {
            return items;
        }
    
    }
    

    Update: a live demo can be found in the “Expandable list” example of the <o:componentIdParam> page of current showcase application.

    Update 2): PrimeFaces p:datascroller has lazyloading with ‘on demand scrolling’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.