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

  • Home
  • SEARCH
  • 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 6238691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:15:34+00:00 2026-05-24T11:15:34+00:00

I’m a total newbie with the jsf and ICEfaces frameworks, and we started to

  • 0

I’m a total newbie with the jsf and ICEfaces frameworks, and we started to playing around with them a couple of weeks ago.

Now we are trying to perfom a push without using AJAX, in order to make this operation avaiable trough a WebService.

I found this thread, which seems to be something like we want to do, but I’m still a bit lost. The guy claims to have succeded:

I wired my Renderable class into my
web service so it simply has to call
the appropriate method to request the
render.

Could anybody give me a hint on how to “wire” the WebService to the Renderable class?
I suspect there is something to do with the PortableRendered, but as I told you, I’m still a bit lost.

Regards.

  • 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-05-24T11:15:35+00:00Added an answer on May 24, 2026 at 11:15 am

    The following example is the simplest case. A sports score is updated in the web browser every two seconds using an ICEfaces push update.

    The method ScoreManagerBean.postConstruct() is called after the managed bean is constructed for a new session. This method starts a thread that calls PortableRenderer.render(sessionId) every two seconds, causing the new score to be pushed to the web browser. In a real application, the push update would be run in some kind of callback function after receiving a message/trigger that data in the application has changed.

    Exactly the same concept is used for more complex applications such as news-tickers and ebay-style auction sites.

    Here is the managed bean class ScoreManagerBean.java:

    import javax.annotation.PostConstruct;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    import javax.faces.context.FacesContext;
    import javax.servlet.http.HttpSession;
    import java.util.Random;
    
    import org.icefaces.application.PortableRenderer;
    import org.icefaces.application.PushRenderer;
    
    @ManagedBean(name = "scoreManager")
    @SessionScoped
    public class ScoreManagerBean
    {
        private int m_nPointsA = 0;
        private int m_nPointsB = 0;
        private PortableRenderer m_renderer;
        private String m_sessionId;
    
        @PostConstruct
        public void postConstruct()
        {
                FacesContext facesContext = FacesContext.getCurrentInstance();
                HttpSession session;
                session = (HttpSession)facesContext.getExternalContext().getSession(false);
                m_sessionId = session.getId();
                PushRenderer.addCurrentSession(m_sessionId);
                m_renderer = PushRenderer.getPortableRenderer(facesContext);
                new BidThread().start();
        }
    
        public String getCurrentScore()
        {
                return m_nPointsA + "-" + m_nPointsB;
        }
    
        private class BidThread extends Thread
        {
                public void run()
                {
                        Random r = new Random();
                        for (int i = 0; i < 1000; i++)
                        {
                                try
                                {
                                        sleep(2000);
                                        System.out.println("Score has changed");
                                        if (r.nextInt() % 2 == 0)
                                                m_nPointsA++;
                                        else
                                                m_nPointsB++;
                                        m_renderer.render(m_sessionId);
                                }
                                catch (Exception e)
                                {
                                        e.printStackTrace();
                                }
                        }
                }
        }
    }
    

    and the web page pushexample.xhtml that displays the current score:

    <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:icecore="http://www.icefaces.org/icefaces/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    
    <h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    </h:head>                                   
    
    <h:body>
    <ice:outputText value="Current score: #{scoreManager.currentScore}"/>
    </h:body>
    </html>        
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.