| 
| importPackage does not work [message #57277] | Wed, 13 July 2005 03:17  |  | 
| Eclipse User  |  |  |  |  | Im trying to use importPackage  in  birt  version 1.0.1M1 but I get the following error:
 
 Error0 : data.engine.JSScriptInvalid(1 time)
 detail: Invalid Javascript expression. Source: DataSet:setScript.open,
 line: 0, Expression:
 function_prefix_1121238524940();function
 function_prefix_1121238524940(){importPackage(java.io)}
 Script engine error: ReferenceError: "importPackage" is not defined.
 |  |  |  | 
|  | 
| 
| Re: importPackage does not work [message #59270 is a reply to message #57851] | Sat, 16 July 2005 05:01  |  | 
| Eclipse User  |  |  |  |  | Hi Stanley 
 i have try to play a little with packages using several scenarios having as
 playground my Article about Birt and POJOs [1] and this why i have recieve
 some comments about this.
 
 Scenario 1
 ----------
 POJO's classes exist in :
 C:\JProgramFiles\eclipse-SDK-3.0.2-win32\eclipse\plugins\org .eclipse.birt.report.viewer_1.0.0\birt\WEB-INF\classes\{pack age
 structure}
 
 access those POJOs in report's open method like:
 
 <snip>
 count = 0;
 cf = new Packages.gr.osmosis.report.data.ContactListFactory();
 c = cf.createContactList();
 </snip>
 
 this scenario work fine
 
 Scenario 2
 ----------
 POJO's classes exist as .jar in  :
 C:\JProgramFiles\eclipse-SDK-3.0.2-win32\eclipse\plugins\org .eclipse.birt.report.viewer_1.0.0\birt\WEB-INF\lib\myJarFile .jar
 
 access those POJOs in report's open method like:
 
 <snip>
 count = 0;
 cf = new Packages.gr.osmosis.report.data.ContactListFactory();
 c = cf.createContactList();
 </snip>
 
 this scenario work fine too
 
 Here now comes the troubles:
 
 in both scenarios i get error messages when i change the code snip to
 something lik
 
 <snip>
 importPackage(Packages.gr.osmosis.report.data);
 count = 0;
 cf = new ContactListFactory();
 c = cf.createContactList();
 </snip>
 
 considering rhino documentation [2] i have try to use importClass instead of
 importPackage but without success
 
 here are the error messages:
 
 1. using importPackage
 
 There are errors on the report page:Error1:Invalid Javascript expression.
 Source: DataSet:setScript.open, line: 0,
 Expression:function_prefix_1121503320257();function
 function_prefix_1121503320257(){importPackage(Packages.gr.os mosis.report.data)count
 = 0;cf = new ContactListFactory();c = cf.createContactList();}Script engine
 error: ReferenceError: "importPackage" is not defined.
 
 
 2. using importClass
 
 There are errors on the report page:Error1:Invalid Javascript expression.
 Source: DataSet:setScript.open, line: 0,
 Expression:function_prefix_1121503320258();function
 function_prefix_1121503320258(){importClass(Packages.gr.osmo sis.report.data.ContactListFactory);count
 = 0;cf = new ContactListFactory();c = cf.createContactList();}Script engine
 error: ReferenceError: "importClass" is not defined.
 
 I have to notice that the code snip exist into report's open method.
 
 i will appreciate any comment about this. is some piece that i'm missing ?
 
 regards
 
 stavros
 
 
 [1]  http://tools.osmosis.gr/blog/archives/2005/06/birt_and_objec t.html
 [2] http://www.mozilla.org/rhino/scriptjava.html
 
 
 "Stanley Wang" <swang@actuate.com> wrote in message
 news:db4038$edf$1@news.eclipse.org...
 > Try to use
 >
 > importPackage(Packages.java.util);
 >
 > instead of
 >
 > importPackage(java.util);
 >
 > for now.
 >
 > Stanley Wang
 > BIRT Engine
 >
 > S.Taaouati wrote:
 >> I?m trying to use ?importPackage?  in  birt  version 1.0.1M1 but I get
 >> the following error:
 >>
 >> Error0 : data.engine.JSScriptInvalid(1 time)
 >> detail: Invalid Javascript expression. Source: DataSet:setScript.open,
 >> line: 0, Expression:
 >> function_prefix_1121238524940();function
 >> function_prefix_1121238524940(){importPackage(java.io)}
 >> Script engine error: ReferenceError: "importPackage" is not defined.
 >>
 >>
 
 --
 Stavros S. Kounis
 Osmosis networks & consulting   http://www.osmosis.gr
 Read my weblog at               http://tools.osmosis.gr/blog
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.03483 seconds