|
JSF and Charts |
Posted by Randy on Apr-07-2009 19:54 |
|
Hi,
I am trying to use JSF with Netbeans 6.5.
I have done some work with this tool and it seem like a great way to built web pages.
Anyway I have built tons of Charts with ChartDirector using JSP and they work great.
I have tried everything I can think of to get them to work in JSF, but no good. I have added my code so you can have a look.
Thanks a ton for you help.
Randy
|
Re: JSF and Charts |
Posted by Peter Kwan on Apr-08-2009 04:02 |
|
Hi Randy,
If the code does not work, is it possible to inform me what is the error message, or the symptom?
If the web page loads normally, but the chart becomes a "red X" (broken image symbol), please go into the "red X" and inform me what is the error message inside. (See http://www.chartdir.com/forum/download_thread.php?site=chartdir&bn=chartdir_faq&thread=1117817200)
I suspect it may have something to do with session variables. Because "getchart.jsp" is not running as a JSF page, it may be possible that it cannot see the session variables created by the JSP page (the getchart.jsp may be is in a different context to the JSF page or there may be other reasons). To confirm if this is related to the issue, please change BaseChart.makeSession to BaseChart.makeTmpFile.
Instead of using makeSession to create the chart, then use getchart.jsp to get the chart, you may use makeTmpFile to create the chart, and use the image file path directly as the image URL. I think it may be like:
//*** NOTE *** : make sure /tmpchart exists and is writable
String chart1URL = c.makeTmpFile(application.getRealPath("/tmpchart"));
...............
//getchart.jsp is not needed with makeTmpFile
_url = request.getContextPath() + "/tmpchart/" + chart1URL;
Please kindly let me know what is the result.
Regards
Peter Kwan |
Re: JSF and Charts |
Posted by Randy on Apr-15-2009 23:55 |
|
Here is the Fix
Chart2 is my bean file and it is located in directconnect package or folder
In the faces-config.xml file I added the following:
<managed-bean>
<managed-bean-name>Chart2</managed-bean-name>
<managed-bean-class>directconnect.Chart2</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
After this was added that fixed the issue.
If I would have created this is a JSF Managed Bean Netbeans would have added that for me.
Once Again Thanks Very Much for your help
Peter |
Re: JSF and Charts |
Posted by Skyfox on Jan-09-2014 18:29 |
|
I'm was trying create Charts in Primefaces. I tried this code and I was looking for
information in some post like this:
http://www.chartdir.com/forum/download_thread.php?
bn=chartdir_general&pattern=JSF&thread=1285061534
I tried use class getChart.jsp but chart wasn't show. It showed a broken image like not
found.
I don't understand how I do it possible. If you could give me some guide lines I would be
eternally grateful. |
|