On 3月5日, 下午11时36分, Norris Boyd <[EMAIL PROTECTED]> wrote:
> On Mar 4, 10:26 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > Dear !
> > There are some functions whose parameter number is not predetermined
> > in browser? How can I implement these function in Rhino?
>
> > Besides, how can I define a static function?
> > In counter, I add the following codes to it ,
> > public static void jsStaticFunction_Open(Context context,
> > Scriptable scriptable, Object args[], Function function)
> > {
> > for(int i = 0;i<args.length;i++)
> > System.out.println(args[i]);
> > }
>
> > I try to visit it as counter.Open("1","2"), there are some error
> > messages " can't find the Open function" !
>
> > Thank you!
> > BinLi!
>
> Have you tried writing your classes in Java and exposing to
> JavaScript? It's a much simpler way to proceed and there are only a
> few pieces of JavaScript functionality that don't have a Java
> equivalent (like dynamic properties).
>
> --N
Dear!
Can you give me a simple example? Maybe you can correct my example
for saving time.
public void jsFunction_Open(Object... args)
{
for(int i = 0;i<args.length;i++)
System.out.println(args[i]);
}
What's more, since my project uses some static function, I want
to know how to define a static
function in java which can be exposed to javascript.
Thank you very much.
BinLi
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino