This takes a single filename as a constructor argument.
Use ScriptTestCase and ScriptTestSuite to generate a suite (auto-generate the collection).
The following features are supported:
shared
.
Java programs set JavaScript Global properties by adding objects to a HashMap. Typically you will at least assign the 'File' and the 'out' objects. The running script will see these objects as properties of the Global object. If you set the 'out' object, the script can use the bare bones 'writeln("foo")' to write to 'out'.
HashMap map = new HashMap(); map.put("File", Vfs.lookup()); map.put("out", System.out); map.put("myObject", myObject); script.execute(map, null);
You can also make any Java object be the global prototype. Essentially, the effect is similar to the HashMap technique, but it's a little simpler.
Scripts are thread-safe. Multiple script instances can safely execute in separate threads. Script.execute creates the entire JavaScript global object hierarchy fresh for each execution. So one Script execution cannot interfere with another, even by doing evil things like modifying the Object prototype.
Of course, wrapped Java objects shared by script invocations must still be synchronized.
NOTE: the design for this is a mess. It needs to be refactored to use the normal Factory pattern. @todo refactor to use normal Factory design pattern.
This class encapsulates script execution relative to an object scope. @since 1.3 @author Norris Boyd
Copyright (c) Xoetrope Ltd., 2002-2006
$Revision: 1.1 $
License: see License.txt
A JEXL Script.
A script is some valid JEXL syntax to be executed with a given set of {@link JexlContext variables}.
A script is a group of statements, separated by semicolons.
The statements can be blocks
(curly braces containing code), Control statements such as if
and while
as well as expressions and assignment statements.
A JEXL Script.
A script is some valid JEXL syntax to be executed with a given set of {@link JexlContext} variabless.
A script is a group of statements, separated by semicolons.
The statements can be blocks
(curly braces containing code), Control statements such as if
and while
as well as expressions and assignment statements.
Note that XHTML script tag doesn't hide the script text withing comments like its HTML counterpart does. This difference is caused by the fact that XHTML is XML and XML parsers can throw the comments out. Use this tag with browsers that support scripting language(s). @version $Id: script.java,v 1.1 2000/11/28 17:35:50 jstoor Exp $ @author Stephan Nagy @author Jon S. Stevens @author Bojan Smojver
This class encapsulates script execution relative to an object scope. @since 1.3 @author Norris Boyd
Approach 3: Specify the JavaScript codes directly with defer. The JavaScipt codes are evaluated after the widget is instantiated and mounted. Moreover, this
references to the script widget, so you can access the widgets as follows.
<script defer="true"> this.getFellow('l').setValue('new value'); //... </script>
Alternative to {@link Script}, you can use the script directive as shown below..
<:?script src="/js/mine.js"?/> <:?script content="jq.IE6_ALPHAFIX=/.png/"?/>
@author tomyeh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|