全局对象和函数
1.applicationScope:
允许您在应用程序的持续时间内跨页共享值。
第一个页面这样做:
applicationScope.put("hello","helloWord");
第二个页面这样做:
applicationScope.get("hello");
只要应用程序存在值就会一直存在。当你点击第一个页面的按钮并且关闭了应用程序后,重新打开
应用程序并打开第二个页面时会发现值仍然存在。
2.requestScope:
允许您在请求期间跨页共享值。
第一个页面这样做:
requestScope.put("hello","helloWord");
context.redirectToPage("page2");
第二个页面这样做:
requestScope.get("hello");
只在一次请求中有效,刷新页面后无效
3.sessionScope:
允许您在会话期间跨页共享值
第一个页面这样做:
sessionScope.put("hello", "Hello session");
第二个页面这样做:
sessionScope.get("hello");
只要会话存在, 该值就会持续。如果关闭该应用程序, 则该值将消失
4.getComponent :
获取 UI 组件的基对象
语法:getComponent(id:string)
id:UI 控件的名称
使用案例:
getComponent("inputText3").setValue(getComponent("inputText1").getValue() +getComponent("inputText2").getValue())
5.getLabelFor:
获取与 UI 组件相关联的标签的基对象。
案例:
try {
return getLabelFor(getComponent("inputText1")).getValue()
} catch(e) {
return "No label"
}