[prev in list] [next in list] [prev in thread] [next in thread]
List: bsf-user
Subject: RE: Evaluate a javascript string. Not a file.
From: Jon Schuster <jons () wrq ! com>
Date: 2004-07-13 15:59:36
Message-ID: 1A6B6A5A3597C340BB63728001DC787958AF12 () kodos ! na ! wrq ! com
[Download RAW message or body]
Hi Klaas,
BSFManager.eval (or BSFEngine.eval) should be the right method to use to
evaluate one or more JavaScript statements. Although the eval method takes
the name of a source as the first argument, the actual script statements are
passed as the last argument.
Although I haven't used eval to evaluate statements entered in a text field,
I've essentially been doing the equivalent operation by reading in the
contents of a file from disk, making it into a string, then passing the
string to the eval method as the last argument. I pass 0,0 as the line and
column numbers. The sequence looks something like this:
BSFManager mgr = new BSFManager();
mgr.eval( "javascript", scriptname == null ? "internal" :
scriptname, 0,0, statements );
--Jon
-----Original Message-----
From: Nebuhr, Klaas / Encoway [mailto:nebuhr@encoway.de]
Sent: Tuesday, July 13, 2004 6:58 AM
To: bsf-user@jakarta.apache.org
Subject: Evaluate a javascript string. Not a file.
Hi,
I just read the infos at the bsf homepage. I downloaded the milestone build
and now try to set up my first application. At the moment I have a problem
evaluating a string. I instantiated an bsfmanger and used
loadScriptingEngine to get my javascript engine. What I need to to is to
evaluate a string that a user has written down in a textfield. I only found
one eval methode which seems not to be the one I am looking for.
Can anybody help me? Maybe bsf is not the right thing to do the job.
BTW I didn't found the javadoc for the api.
Thanks in advance,
Klaas Nebuhr
Productmanagement
encoway GmbH & Co KG
Universitätsallee 21-23
D-28359 Bremen
T +49 (0)421 24677-0
F +49 (0)421 24677-10
http://www.encoway.de
---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic