Overview
Other MyFaces Extensions
- ExtVal
- Ext-Script
- [Orchestra]
- [Portlet Bridge]
Community
Development
Sponsorship
Your browser does not support iframes
...
The Intro page provides an overview and describes the motivation for the features described below. This page explains the most important APIs and mechanisms of the scripting module provided by CODI.
The page CODI Modules provides an overview about CODI modules and how to add them to your project.
For using the features described in this page, you have to add the core and the scripting module.
For very simple cases you can inject the ScriptExecutor
directly.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public class ServerSideScriptingBean
{
@Inject
@ScriptLanguage(JavaScript.class)
private ScriptBuilder scriptBuilder;
//...
private Double calc(Double a, Double b)
{
return this.scriptBuilder
.script("x + y")
.namedArgument("x", a)
.namedArgument("y", b)
.eval(Double.class);
}
}
|
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public class ServerSideScriptingBean { @Inject @ScriptLanguage(JavaScript.class) private ScriptEngine scriptEngine; //... protectedprivate Double calc() throws ScriptException { return (Double)this.scriptEngine.eval("3 + 4"); } } |
...