loading contents of lazily

后端 未结 1 913
夕颜
夕颜 2021-01-20 14:35

Is it possible to implement live scrolling or lazy scrolling in a

which has loop. I have the following codes in a
相关标签:
1条回答
  • 2021-01-20 14:42

    Both JSTL and EL will be able only during view build time of the page (this is done by server). Ajax requests aren't part of view build time since they're in client browser, so JSTL and EL are useless to handle ajax requests. Still, you can make use of ajax with plain servlets as stated here: How to use Servlets and Ajax?

    Since you're using JSF in your code (based on the use of deferred evaluation expression like #{statusBean.statusList} and <h:form>) and assuming you use JSF 2+, there's a good example in OmniFaces showcase: <o:componentIdParam>, the Expandable list example shows that you can make an ajax call to a @RequestScoped managed bean and retrieve a JSON String and use it to update values on client side like HTML dom.

    Live scroll example based on this answer:

    $(window).scroll(function(){
        if  ($(window).scrollTop() == $(document).height() - $(window).height()){
           loadNewData();
        }
    });
    
    function loadNewData(){
        /* add code to fetch new content and add it to the DOM */
    }
    
    0 讨论(0)
提交回复
热议问题