Chris,

There are two possible causes both related to type conversion.

1)  Does util.printd have signature (String, NativeDate)?  If not, JS
might be trying to coerce the here.
2)  Assignment to event.value.  What is the signature of event.setValue(
XX )?

You can try inserting a \n char in the code string to see if the
TypeError changes lines:

Code = "event.value = \n util.printd("mmmm d, yyyy", new Date());"

Kevin

-----Original Message-----
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
lla.org] On Behalf Of chris wade orange
Sent: Tuesday, June 10, 2008 9:39 AM
To: [email protected]
Subject: HELP adding javascript to a java applications

I keep getting this warning and I cant figure out why.

TypeError: Cannot find default value for object. (<cmd>#1)

I get it with this code:-
code  = "event.value = util.printd("mmmm d, yyyy", new Date());";

Object testjs_event = org.mozilla.javascript.Context.javaToJS( testjs,
scope );
        org.mozilla.javascript.ScriptableObject.putProperty( scope,
"event", testjs_event );

Object testjs_util = org.mozilla.javascript.Context.javaToJS( testjs,
scope );
        org.mozilla.javascript.ScriptableObject.putProperty( scope,
"util", testjs_util );

Object result = cx.evaluateString(scope, code, "<cmd>", 1, null);


The testjs is an object of class with these javascript methods in:-
    private int value = -1;
    public void jsConstructor(int inVal)
    public int jsGet_value()  
    public void jsSet_setValue(int inVal)

Can anyone shed any light on this situation please?

Kind Regards all

Chris wade

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to