EGL にはビルトイン関数のライブラリーがいくつか含まれています。以下で、それらのライブラリーの一部について簡単に説明します。ライブラリーごとに、関連したヘルプ・トピックがあります。
また、EGL には、実行時に更新されるシステム変数の sysVar ライブラリーが含まれています。
例として、前述のライブラリーに含まれているもののうち、最もよく使用される関数および変数について説明します。
この関数は、データ・テーブルの行の数または配列内のエレメントの数を戻します。その場合の配列は、構造項目配列、dataItem またはレコードの静的配列、dataItem またはレコードの動的配列のいずれかです。
Web アプリケーションでは、このシステム変数に Web アプリケーション・サーバー・セッション固有の ID が入ります。この値は、プログラム間で共有するファイルまたはデータベース情報にアクセスするためのキー値として使用することができます。
この関数は数値の平方根を戻します。この関数は、0 以上の数値を処理します。
この演習では、以上のビルトイン関数および変数をいくつか使用する Web ページを作成します。
SystemLibraries
package pagehandlers; import data.*; PageHandler SystemLibraries {view = "SystemLibraries.jsp", onPageLoadFunction = onPageLoad} fields fieldsForDisplay; customers customer[]; Function onPageLoad() CustomerLib.getAllCustomers(customers); J2EELib.setSessionAttr("sess",fields.setSessionAttrValue); End //This is the main function of the PageHandler. //It calls the system functions. function callEGLSystemFunctions() fields.tableValue = sysLib.Size(Customers); fields.sqrtResult = mathLib.sqrt(fields.sqrtValue); fields.currentDateValue = VGVar.currentGregorianDate; J2EELib.getSessionAttr("sess",fields.getSessionAttrValue); fields.sessionIDValue = sysVar.sessionID; fields.findPositionInString = 1; fields.findSuccessFail = strLib.findStr(fields.stringValue, fields.findPositionInString,fields.findStringLength, fields.findStringValue); end End //Structure of variables used in system calls Record fieldsForDisplay type basicRecord tableValue int; setSessionAttrValue int {value=1111}; getSessionAttrValue int; sqrtValue int {value=111}; sqrtResult decimal(7,2); currentDateValue char(10); stringValue char(222) {value="This is my full character variable."}; findStringValue char(5) {value="full"}; findPositionInString int {value=1}; findStringLength int {value=222}; findSuccessFail int; sessionIDValue char(8); end
以下は、ここで挿入したコードに関する技術面での注釈です。
ページは次のようになります。
ヘルプ・トピックで、その他の EGL システム関数について調べることができます。
「演習 3.3: セッション変数のトラッキング」に進んでください。