EGL 包括若干个内置函数的库。下面是对其中一些库的简要描述。每个库都有一个相关联的帮助主题。
另外,EGL 包括了系统变量的 sysVar 库,会在运行时更新这些系统变量。
例如,以下是这些库中一些最常用的函数和变量的描述:
此函数返回数据表中的行数或数组中的元素个数。该数组可以是结构项数组、数据项或记录的静态数组,或者数据项或记录的动态数组。
在 Web 应用程序中,此系统变量包含特定于 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 系统函数。