Javascript error using v0.1.5

15 views
Skip to first unread message

Flávio Henrique

unread,
May 19, 2009, 5:19:47 PM5/19/09
to JSFlot JavaServer Faces JSF Chart Library
Hi there!
Today I decided to test JSFlot and could'nt start the chart.
Nothing appears on browser, and Firebug says:

Flotr is not defined
http://localhost:8090/jsflot/jsflot.jsf
Line 6

Line 6 = "var f = Flotr.draw($('valueTimeChart'), [ {"

My simple xhtml test page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:jsflot="http://www.jsflot.org/taglib/jsflot">
<head>
<jsflot:resources />
</head>
<ui:composition>
<h:form>
<jsflot:flotChart
id="valueTimeChart"
value="#{chartMbean.chartSeries}"
showLines="true"
fillLines="false"
showDataPoints="false"
legendColumns="1"
legendOpacity="0.85"
legendPosition="n"
legendColor="bllue"
height="300"
width="300"
showTooltip="false"
tooltipPosition="n"
tooltipFollowMouse="false"
mode="Series"
title="Titulo"
subtitle="Subtitulo"
chartType="Line"
showXaxisLabels="true"
xaxisTitle="X Title"
showYaxisLabels="true"
yaxisTitle="Y Title"
numberOfXAxisTicks="5"
xaxisMinValue="0"
xaxisMaxValue="5"
numberOfYAxisTicks="5"
yaxisMinValue="0"
yaxisMaxValue="5" />
</h:form>
</ui:composition>
</html>

What I'm missing ?

Thank you.

Flávio Henrique

Flávio Henrique

unread,
May 19, 2009, 5:22:22 PM5/19/09
to JSFlot JavaServer Faces JSF Chart Library
I'm sorry.
I forgot to mention: I'm using: richfaces 3.3.1, jsf 1.2_12, facelets
1.1.14, jdk 6, tomcat 6.

thank you!

Joachim H. Skeie

unread,
May 19, 2009, 5:28:54 PM5/19/09
to JSFlot JavaServer Faces JSF Chart Library
Thank you very much for your feedback.

I have two questions that might give me more insight on what might be
wrong.

1. Is there a number of JavaScript files added to the HEAD portion of
the generated HTML ? There should be lines like:

<script type="text/javascript" src="/JSFlot.Web/faces/jsflot/
canvastext.js"></script>
<script type="text/javascript" src="/JSFlot.Web/faces/jsflot/
flotr.js"></script>
<script type="text/javascript" src="/JSFlot.Web/faces/jsflot/
dateformat.js"></script>

Also, if you try to load any of these, do they display as expected in
the browser ?

2. How are you mapping the Faces Servlet ? I have tested with
extensions, as well as the /faces/* prefix.

Very Best Regards,
Joachim Haagen Skeie

On May 19, 11:19 pm, Flávio Henrique <yoshi...@gmail.com> wrote:
> Hi there!
> Today I decided to test JSFlot and could'nt start the chart.
> Nothing appears on browser, and Firebug says:
>
> Flotr is not definedhttp://localhost:8090/jsflot/jsflot.jsf

Flávio Henrique

unread,
May 19, 2009, 5:41:31 PM5/19/09
to jsf...@googlegroups.com
Hi Joachim!
Thank you for the prompt answer.

Lets see:

1. Is there a number of JavaScript files added to the HEAD portion of
the generated HTML ? There should be lines like:

<script type="text/javascript" src="/JSFlot.Web/faces/jsflot/
canvastext.js"></script>
<script type="text/javascript" src="/JSFlot.Web/faces/jsflot/
flotr.js"></script>
<script type="text/javascript" src="/JSFlot.Web/faces/jsflot/
dateformat.js"></script>

No. No javascript files loaded.
Look my generated html:

Also, if you try to load any of these, do they display as expected in
the browser ?

No.
Trying to load those files do not show nothing and got the same javascript error.
 


2. How are you mapping the Faces Servlet ? I have tested with
extensions, as well as the /faces/* prefix.

I'm mapping as:
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>


Thank you.

Flávio Henrique

Joachim H. Skeie

unread,
May 19, 2009, 6:00:41 PM5/19/09
to JSFlot JavaServer Faces JSF Chart Library
Hello again,

The environment difference might pay a part. My setup used Java 5 and
Jetty as the Servlet Container, however this shouldn't really matter.

There seems to be something matter with the <jsflot:resources /> tag,
as this is supposed to put the <script... /> tags in the generated
HTML. Looking at you example, it looks like you are building a test,
are you able to supply a .WAR file that I can have a look in to see
what might be going wrong ?

Very Best Regards,
Joachim Haagen Skeie

On May 19, 11:41 pm, Flávio Henrique <yoshi...@gmail.com> wrote:
> Hi Joachim!Thank you for the prompt answer.

Flávio Henrique

unread,
May 20, 2009, 12:03:11 PM5/20/09
to jsf...@googlegroups.com
Hello Joachim!
I'm sending the .war file to you.

I need to mention some problems that I saw here, that could explain (maybe):
just adding the jsflot-0.1.5.jar to my project and the xmlns:jsflot="http://www.jsflot.org/taglib/jsflot" tag to an existing page, don't bring the <jsflot: tags (autocomplete) to my Eclipse IDE (something with tld file?).
Only using JBoss Tools plugin to add the namespace tag, on page creation, seems to "tell" the IDE where is the tld file...
I dont know if this could be the reason... just thinking...

Thank you for taking care.

Flávio Henrique

--------------------------------------------------------
"Can entropy be reversed?" -- Asimov
--------------------------------------------------------
jsflot.war

Joachim H. Skeie

unread,
May 21, 2009, 8:10:40 AM5/21/09
to JSFlot JavaServer Faces JSF Chart Library
Hello,

I found the error, which there was 2 of.

First, I dropped the <ui:composition> tags, as they are ment to be
used with a Facelet Template file (I just removed them from the
jsflor.xhtml file).
Secondly, the PhaseListener inside the jsflot-0.1.15.jar file loads
resources (JavaScript files and such) assumes a path that starts with /
jsflot/. Since your webapp was called jsflot, the path became /jsflot/
jsflot, which meant that no resources were loaded. I will see if I can
fix this in a later revision. I renamed your .war file to
testjsflot.war, and so the path is /testjsflot/jsflot.

Third, your webapp didnt have Facelets or Richfaces inside WEB-INF/
lib, but I assume that you have these in TOMCAT_HOME/lib or somehow in
your classpath elsewhere.

Hope that solves your issue.

Very Best Regards,
Joachim Haagen Skeie

On May 20, 6:03 pm, Flávio Henrique <yoshi...@gmail.com> wrote:
> Hello Joachim!I'm sending the .war file to you.
>  jsflot.war
> 3466KViewDownload

Flávio Henrique

unread,
May 21, 2009, 4:33:00 PM5/21/09
to jsf...@googlegroups.com
Hi Joachim,
thank you for your help.
in fact, removing <ui:composition>, but not changing the project's name, makes the chart show up in Google Chrome, but not in FF3 or IE6.
changing the project name or creating a new one, with diferent name, without facelets or richfaces (only with jsf1.2 and jsflot), I couldn't get the chart.

I'm making more tests here to try to discovery what happening, and I will let you know later.

I hope that you can see me as a 'tester', not a bothering asker. :)

BTW, your JSFlot Live Demo page isn't 'live'... can you take a look?

thank you!
Reply all
Reply to author
Forward
0 new messages