9.2.5 Script
A Script Web component allows you to create a JavaScript or VBScript function (or script fragment) and embed such a function into your Web function application.
The script file is defined using the Web Function Editor. LANSA for the Web does not validate the script functions specified in the script Web component. Once the file is defined in the Web Function Editor, it must be registered as a Web component.
LANSA for the Web does not restrict you to a particular script language. In other words, you could be creating a JavaScript or VBScript script Web Component. Again, LANSA for the Web does not validate the script functions specified in the script Web component. You must ensure that the script you have created is syntactically correct. You must verify your script before creating it as a script Web component.
One difference between a Script Web component and other Web components is that the last line of a Script Web component doesn't include a carriage return (or carriage return/line feed pair on Windows) at the end of the component. This prevents an unwanted line break when the component content is just a script fragment, rather than a complete script function. If you want the last line of your Script web component to end with a carriage return, insert a blank line at the end of the component.
If you are defining script functions, you should remember that these functions should be included in the header of the HTML pages so that the functions are loaded before they are called.
The JavaScript functions used by LANSA for the Web are contained in the DEFAULT_SCRIPT component. You can also modify this component to include your own JavaScript functions, and then save the file as a process-specific page. Using this technique, you do not need to register the process-specific page as a Web page component.
For details about creating script Web components, refer to 9.2.6 Naming Page and Script Web Components and Script Component (HTML mode).