sgscript: JavaScript for TaskGuide

JavaScript (aka EcmaScript) is, by far, the most popular scripting language for the Web. Fesi is a Java-based EcmaScript interpreter developed by Jean-Marc Lugrin.
IBM's TaskGuide is a very powerful and versatile Java tool for creating wizards. TaskGuide supports both Java and Rexx as scripting languages.

sgscript is a simple TaskGuide exit Java class that provides access to the Fesi EcmaScript interpreter from your wizard scripts.

Why sgscript?

Scripting languages differ from full-fledged programming languages (such as Java) in a number of ways. One of them is the quick'n'dirty approach of coding and then testing without the hassle of compiling or the need to impose a complex structure to otherwise simple programming tasks.

EcmaScript provides the ideal language for scripting a tool like TaskGuide: it requires no compilation or classpath setups, is considerable easier to program in than Java and is much more popular than Rexx (with all due respect for these powerful languages). Fesi's implementation, being Java-based, offers full access to all Java objects while retaining EcmaScript's simplicity.

TaskGuide developers know for certain that any non-trivial wizard requires Java exits to handle tasks such as database access, file manipulation or complex validations. While developing such exits in Java is simple thanks to TaskGuide's elegant SmartGuideExit interface, it may become cumbersome as the number of panels increases.

Here is where EcmaScript comes to the rescue!

How does sgscript work?

With sgscript, it's simple to call EcmaScript functions stored in external script files from your TaskGuide wizards. The following snippet shows how to invoke the sgscript Java exit to access Fesi's EcmaScript interpreter:

An sgscript Example
. . .
    <variable name="loadScript" init="java EcmaScript @load">
. . .
    <panel name="getCustomerInfo" next="java EcmaScript checkInfo();">
. . .
. . .

In this example:

That's all it takes!

EcmaScript exits can contain logic to manipulate files, access JDBC databases or even communicate with RMI servers! Virtually anything you can accomplish with Java is also possible with Fesi.

Wanna give it a try?

You're encouraged to download and test sgscript (367k zipped). This file already includes the runtime Fesi library. I request your feedback about this little utility as well as your suggestions on how to improve it.

sgscript comes with an example wizard (demo.sgs) for building a very simple Web home page. Of course, all exits in this example are written in EcmaScript.

Before running demo.bat make sure your classpath includes EcmaScript.class, Fesi and TaskGuide!

You may also want to edit the script file to change the default browser from "explorer" to "netscape" or your favorite browser executable.

Take a look at the code! There's no documentation like the real thing :-)

Comments can be sent to Ricardo Rocha. Enjoy!