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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:41:25+00:00 2026-05-14T16:41:25+00:00

I want to create a component which can be used like: <mc:chart data=#{bean.data} width=200

  • 0

I want to create a component which can be used like:

<mc:chart data="#{bean.data}" width="200" height="300" />

where #{bean.data} returns a collection of some objects or chart model object or something else what can be represented as a chart (to put it simple, let’s assume it returns a collection of integers).

I want this component to generate html like this:

<img src="someimg123.png" width="200" height="300"/>

The problem is that I have some method which can receive data and return image, like:

public RenderedImage getChartImage (Collection<Integer> data) { ... }

and I also have a component for drawing dynamic image:

<o:dynamicImage width="200" height="300" data="#{bean.readyChartImage}/> 

This component generates html just as I need but it’s parameter is array of bytes or RenderedImage i.e. it needs method in bean like this:

public RenderedImage getReadyChartImage () { ... }

So, one approach is to use propertyChangedListener on submit to set data (Collection<Integer>) for drawing chart and then use <o:dynamicImage /> component. But I’d like to create my own component which receives data and draws chart.

I’m using facelets but it’s not so important indeed. Any ideas how to create the desired component?

P.S. One solution I was thinking about is not to use <o:dynamicImage/> and use some servlet to stream image. But I don’t know how to implement that correctly and how to tie jsf component with servlet and how to save already built chart images (generating new same image for each request can cause performance problems imho) and so on..

  • 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-14T16:41:25+00:00Added an answer on May 14, 2026 at 4:41 pm

    P.S. One solution I was thinking about is not to use and use some servlet to stream image. But I don’t know how to implement that correctly and how to tie jsf component with servlet and how to save already built chart images (generating new same image for each request can cause performance problems imho) and so on..

    Just give it an URL as attribute so that it ends up as <img src="url"> and let that URL point to the servlet. Let the servlet generate/return the image based on the information provided by request parameters or pathinfo in the URL.

    As to the caching, just store it somewhere in the disk file system or a DB by some unique identifier and let the servlet on every request check if it is there and handle accordingly.

    For this all the standard <h:graphicImage> would be already sufficient. Just make the URL dynamic.

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

Sidebar

Ask A Question

Stats

  • Questions 434k
  • Answers 434k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer That's a very strange way for them to format the… May 15, 2026 at 3:19 pm
  • Editorial Team
    Editorial Team added an answer Can you make the XmlRepository generic and use typeof to… May 15, 2026 at 3:19 pm
  • Editorial Team
    Editorial Team added an answer You could host the PowerShell engine to check this using… May 15, 2026 at 3:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.