velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jill han" <j...@bynum.com>
Subject RE: load a file through javascript
Date Mon, 05 Jan 2009 20:24:04 GMT
I am using turbine/torque/velocity framework. The reason that I think
there is something to do with the framework is that
 
 in the following simple anychart.jsp, the javascript has no problem
loading data.xml.   
 
<html>
  <head>
      <title>AnyChart external data sample</title>
  </head>
  <body> 

    <script type="text/javascript" language="javascript"
src="com.anychart/js/AnyChart.js"></script>
<script type="text/javascript" language="javascript">
//<![CDATA[
	var chart1 = new AnyChart("com.anychart/swf/AnyChart.swf");
	chart1.width='550px';
	chart1.height='400px';
	chart1.setXMLFile('./data.xml');
	chart1.write(); 
//]]>
</script>
  </body>
</html>

Thanks.
-----Original Message-----
From: Nathan Bubna [mailto:nbubna@gmail.com] 
Sent: Monday, January 05, 2009 1:15 PM
To: Velocity Users List
Subject: Re: load a file through javascript

On Mon, Jan 5, 2009 at 10:05 AM, jill han <jhan@bynum.com> wrote:
> If data.xml, or data.vm  is   outside of templates, for example,
> chart1.setXMLFile("$content.getURI('data/data.vm')");
>
> data.vm will be read properly, the graph will be drawn.
> However, data.vm will be static, since $object will not be
interpreted.
> It is not what we want. We want to plot the graph based on the user
> login data.

your javascript is loading the xml file.   javascript knows nothing
about velocity, nor can it process velocity templates for you.   if
your xml is generated from a velocity template, then that must be done
before the xml is sent to the javascript.

> It seems somehow the framework caused .setXMLFile not working
properly.

what framework?

> Correct me if I am wrong.
>
> Thanks,
> Jill
>
> -----Original Message-----
> From: Nathan Bubna [mailto:nbubna@gmail.com]
> Sent: Monday, January 05, 2009 10:42 AM
> To: Velocity Users List
> Subject: Re: load a file through javascript
>
> Sounds like a question for whoever created AnyChart, because Velocity
> is entirely server-side.  Velocity is not doing the loading of the xml
> file, the javascript is doing that.
>
> On Mon, Jan 5, 2009 at 7:31 AM, jill han <jhan@bynum.com> wrote:
>> We have a turbine/torque/velocity application. I tried to embed
> AnyChart
>> to the app. Here is the snippet of anychart.vm code
>>
>> <script type="text/javascript" language="javascript">
>> //<![CDATA[
>>        var chart1 = new
>> AnyChart("$content.getURI("swf/AnyChart.swf")");
>>        chart1.width="550px";
>>        chart1.height="400px";
>>
>>
>
chart1.setXMLFile("$content.getURI('servlet/nequals1/template/portal,dat
>> a,data.xml')");
>>        chart1.write();
>> //]]>
>> </script>
>>
>> AnyChart.swf is read fine. However, for some reason, the data.xml
file
>> couldn't be read properly. It ended up with IO error.
>> Any help and suggestions will be appreciated as always.
>>
>> Jill
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message