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 853593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:47:04+00:00 2026-05-15T07:47:04+00:00

I am doing a project where I am using JSF 2.0 & Primefaces UI

  • 0

I am doing a project where I am using JSF 2.0 & Primefaces UI Components.

There is a tab view component with tabs, “Day”,”Week” & “Month”. In all tab, I have to display Bar Charts in each. For the same, I am fetching three list using the following three method. In the following code, UpdateCountHelper is fetching the data from database. So, UpdateCountHelper is taking some time for fetching data.

This is code for fetching lists :

public List<UpdateCount> getDayUpdateCounts() {
        if (projectFlag == true) {
            if (displayFlag == 1) {
                dayUpdateCounts = UpdateCountHelper.getProjectUpdates(1);
            } else {
                dayUpdateCounts = UpdateCountHelper.getProjectUpdates(name, 1);
            }
        } else {
            dayUpdateCounts = UpdateCountHelper.getResourceUpdates(userName, 1);
        }

        return dayUpdateCounts;
    }

    public List<UpdateCount> getMonthUpdateCounts() {
        if (projectFlag == true) {
            if (displayFlag == 1) {
                monthUpdateCounts = UpdateCountHelper.getProjectUpdates(30);
            } else {
                monthUpdateCounts = UpdateCountHelper.getProjectUpdates(name, 30);
            }
        } else {
            monthUpdateCounts = UpdateCountHelper.getResourceUpdates(userName, 30);
        }

        return monthUpdateCounts;
    }

    public List<UpdateCount> getWeekUpdateCounts() {
        if (projectFlag == true) {

            if (displayFlag == 1) {
                weekUpdateCounts = UpdateCountHelper.getProjectUpdates(7);
            } else {
                weekUpdateCounts = UpdateCountHelper.getProjectUpdates(name, 7);
            }
        } else {
            weekUpdateCounts = UpdateCountHelper.getResourceUpdates(userName, 7);
        }

        return weekUpdateCounts;
    }

This is code for UI of Bar Chart :

<p:panel id="Chart">
                <p:tabView dynamic="false" cache="false">
                    <p:tab title="Day">
                        <p:panel id="chartDayPanel">
                            <center>
                                <h:outputText id="projectWiseDayText" rendered="#{systemUtilizationServiceBean.projectFlag}" value="Project Wise Day Update"/>
                                <p:columnChart id="projectWiseDayUpdateChart" rendered="#{systemUtilizationServiceBean.projectFlag}" value="#{systemUtilizationServiceBean.dayUpdateCounts}" var="dayWiseUpdate" xfield="#{dayWiseUpdate.name}" height="200px" width="640px">
                                    <p:chartSeries label="Project Wise Current Day Update" value="#{dayWiseUpdate.noUpdates}"/>
                                </p:columnChart>
                                <h:outputText id="resourceWiseDayText" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="Resource Wise Day Update"/>
                                <p:columnChart id="resourceWiseDayUpdateChart" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="#{systemUtilizationServiceBean.dayUpdateCounts}" var="dayWiseResourceUpdate" xfield="#{dayWiseResourceUpdate.name}" height="200px" width="640px">
                                    <p:chartSeries label="Resource Wise Current Day Update" value="#{dayWiseResourceUpdate.noUpdates}"/>
                                </p:columnChart>
                            </center>
</p:panel>
                    </p:tab>
                    <p:tab title="Week">
                        <p:panel id="chartWeekPanel">
                            <center>
                                <h:outputText id="projectWiseWeekText" rendered="#{systemUtilizationServiceBean.projectFlag}" value="Project Wise Week Update"/>
                                <p:columnChart id="projectWiseWeekUpdateChart" rendered="#{systemUtilizationServiceBean.projectFlag}" value="#{systemUtilizationServiceBean.weekUpdateCounts}" var="weekWiseUpdate" xfield="#{weekWiseUpdate.name}" height="200px" width="640px">
                                    <p:chartSeries label="Project Wise Current Week Update" value="#{weekWiseUpdate.noUpdates}"/>
                                </p:columnChart>
                                <h:outputText id="resourceWiseWeekText" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="Resource Wise Week Update"/>
                                <p:columnChart id="resourceWiseWeekUpdateChart" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="#{systemUtilizationServiceBean.weekUpdateCounts}" var="weekWiseResourceUpdate" xfield="#{weekWiseResourceUpdate.name}" height="200px" width="640px">
                                    <p:chartSeries label="Resource Wise Current Week Update" value="#{weekWiseResourceUpdate.noUpdates}"/>
                                </p:columnChart>
                            </center>
</p:panel>
                    </p:tab>
                    <p:tab title="Month">
                        <p:panel id="chartMonthPanel">
                            <center>
                                <h:outputText id="projectWiseMonthText" rendered="#{systemUtilizationServiceBean.projectFlag}" value="Project Wise Month Update"/>
                                <p:columnChart id="projectWiseMonthUpdateChart" rendered="#{systemUtilizationServiceBean.projectFlag}" value="#{systemUtilizationServiceBean.monthUpdateCounts}" var="monthWiseUpdate" xfield="#{monthWiseUpdate.name}" height="200px" width="640px">
                                    <p:chartSeries label="Project Wise Current Month Update" value="#{monthWiseUpdate.noUpdates}"/>
                                </p:columnChart>
                                <h:outputText id="resourceWiseMonthText" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="Resource Wise Month Update"/>
                                <p:columnChart id="resourceWiseMonthUpdateChart" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="#{systemUtilizationServiceBean.monthUpdateCounts}" var="monthWiseResourceUpdate" xfield="#{monthWiseResourceUpdate.name}" height="200px" width="640px">
                                    <p:chartSeries label="Resource Wise Current Month Update" value="#{monthWiseResourceUpdate.noUpdates}"/>
                                </p:columnChart>
                            </center>
</p:panel>
                    </p:tab>
                </p:tabView>
            </p:panel>

Now, I have to display same data in other tabview with same tabs as mentioned above & only thing is now I have to display in Pie Chart. Now in pie chart, I am using the same lists. So, it will again fetch the data from database & waste time. To solve that problem I have created other three lists & have given only reference of those previous lists. So, now no database fetching occur.

The Code for applying the reference is :

public List<UpdateCount> getPieDayUpdateCounts() {

        pieDayUpdateCounts = dayUpdateCounts;
        return pieDayUpdateCounts;
    }

    public List<UpdateCount> getPieMonthUpdateCounts() {
        pieMonthUpdateCounts = monthUpdateCounts;
        return pieMonthUpdateCounts;
    }

    public List<UpdateCount> getPieWeekUpdateCounts() {
        pieWeekUpdateCounts = weekUpdateCounts;
        return pieWeekUpdateCounts;
    } 

But, over here the problem occurring is that only chart of which the tab is enable is displayed but the other remaining 2 tabs are not showing any chart.

The code for UI is :

<p:tabView dynamic="false" cache="false">
                <p:tab title="Day">
                    <center>
                        <p:panel id="pieChartDayPanel">
                            <h:outputText id="projectWiseDayPieChartText" rendered="#{systemUtilizationServiceBean.projectFlag}" value="Project Wise Day Update"/>
                            <p:pieChart id="projectWiseDayUpdatePieChart" rendered="#{systemUtilizationServiceBean.projectFlag}" value="#{systemUtilizationServiceBean.dayUpdateCounts}" var="dayWisePieUpdate" categoryField="#{dayWisePieUpdate.name}" dataField="#{dayWisePieUpdate.noUpdates}" height="200" width="200"/>
                            <h:outputText id="resourceWiseDayPieChartText" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="Resource Wise Day Update"/>
                            <p:pieChart id="resourceWiseDayUpdatePieChart" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="#{systemUtilizationServiceBean.dayUpdateCounts}" var="dayWiseResourcePieUpdate" categoryField="#{dayWiseResourcePieUpdate.name}" dataField="#{dayWiseResourcePieUpdate.noUpdates}" height="200" width="200"/>
                        </p:panel>
                    </center>
                </p:tab>
                <p:tab title="Week">
                    <center>
                        <p:panel id="pieChartWeekPanel">
                            <h:outputText id="projectWiseWeekPieChartText" rendered="#{systemUtilizationServiceBean.projectFlag}" value="Project Wise Week Update"/>
                            <p:pieChart id="projectWiseWeekUpdatePieChart" rendered="#{systemUtilizationServiceBean.projectFlag}" value="#{systemUtilizationServiceBean.weekUpdateCounts}" var="weekWisePieUpdate" categoryField="#{weekWisePieUpdate.name}" dataField="#{weekWisePieUpdate.noUpdates}" height="200" width="200"/>
                            <h:outputText id="resourceWiseWeekPieChartText" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="Resource Wise Week Update"/>
                            <p:pieChart id="resourceWiseWeekUpdatePieChart" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="#{systemUtilizationServiceBean.weekUpdateCounts}" var="weekWiseResourcePieUpdate" categoryField="#{weekWiseResourcePieUpdate.name}" dataField="#{weekWiseResourcePieUpdate.noUpdates}" height="200" width="200"/>
                        </p:panel>
                    </center>
                </p:tab>
                <p:tab title="Month">
                    <center>
                        <p:panel id="pieChartMonthPanel">
                            <h:outputText id="projectWiseMonthPieChartText" rendered="#{systemUtilizationServiceBean.projectFlag}" value="Project Wise Month Update"/>
                            <p:pieChart id="projectWiseMonthUpdatePieChart" rendered="#{systemUtilizationServiceBean.projectFlag}" value="#{systemUtilizationServiceBean.monthUpdateCounts}" var="monthWisePieUpdate" categoryField="#{monthWisePieUpdate.name}" dataField="#{monthWisePieUpdate.noUpdates}" height="200" width="200"/>
                            <h:outputText id="resourceWiseMonthPieChartText" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="Resource Wise Month Update"/>
                            <p:pieChart id="resourceWiseMonthUpdatePieChart" rendered="#{systemUtilizationServiceBean.resourceFlag}" value="#{systemUtilizationServiceBean.monthUpdateCounts}" var="monthWiseResourcePieUpdate" categoryField="#{monthWiseResourcePieUpdate.name}" dataField="#{monthWiseResourcePieUpdate.noUpdates}" height="200" width="200"/>
                        </p:panel>
                    </center>
                </p:tab>
            </p:tabView>

What should be the reason behind this ?

  • 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-15T07:47:05+00:00Added an answer on May 15, 2026 at 7:47 am

    Rather than trying to keep multiple copies of your list, use JSF Scopes to manage when/ how often they are fetched.

    Scope your backing bean to RequestScoped or ViewScoped, create a method that fetches the lists from the database (if using CDI, then annotate a method @PostConstruct, otherwise invoke it with a PreRenderViewEvent or in the constructor itself). Now access your lists via simple getters.

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

Sidebar

Related Questions

I am using My-eclipse and doing a struts project there is no syntax error
i 'm doing a project using webview in android. i can't visit url: http://www.baidu.org
I m doing a project using eclipse plugins in jave to create an ide
I'm doing project on object detection using javacv in that I went through couple
I am doing NDK profiling for my project using android-ndk-profiler-3.1. I have made changes
Im doing a project where Alice and Bob send each other messages using the
im using drupal 6.15 and doing my first project in drupal . i got
I'm using WCF Services for a project I'm doing, where the Service will query
I'm setting up a C++ project, on Ubuntu x64, using Eclipse-CDT. I'm basically doing
I'm doing a project using ActionScript 2 where I'm loading in text from an

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.