laszlo 部分
<?xml version="1.0" encoding="GB2312"?>
<canvas bgcolor="0xEAEAEA" height="600" width="800"
oninit="quest.setAttribute('haswindowfocus', true)">
<silverstyle isdefault="true" canvascolor="null"/>
<bluestyle name="bluecolors" canvascolor="null"/>
<goldstyle name="goldcolors" canvascolor="null"/>
<dataset name="checker" src="check.jsp" type="http"/>
<modaldialog id="letmein" height="200" width="300" x="180" y="100" style="bluecolors">
<animator name="fadein" attribute="opacity" from="0" to="1" duration="500" start="false"/>
<method name="doAfter">
quest.fadein.doStart();
bye.setAttribute('text','再见');
</method>
<form id="loginform">
<submit name="doSubmit" data="${checker}"/>
<view id="loginmain" align="center" layout="axis: y; spacing: 20">
<view layout="axis: x; spacing: 5">
<text y="2" >用户:</text>
<edittext width="120" id="username" name="username">哈哈</edittext>
</view>
<view layout="axis: x; spacing: 5">
<text y="2" >密码:</text>
<edittext id="password" width="120" name="password">123</edittext>
</view>
<view align="center" layout="axis:x; spacing:20" y="150">
<button>确认
<method event="onclick">
loginform.doSubmit.submit();
</method>
</button>
<button>取消
<method event="onclick">
letmein.close();
letmein.doAfter();
</method>
</button>
</view>
<datapointer id="respoint" xpath="checker:/response">
<method event="ondata">
if (this.xpathQuery("/response/text()")=="ok") {
letmein.close();
quest.fadein.doStart();
bye.setAttribute('text','欢迎'+username.getText());
quest.out();
}
else
err.open();
</method>
</datapointer>
</view>
</form>
</modaldialog>
<alert id="err">密码错误!</alert>
<window style="goldcolors" id="quest" title="神秘地带"
x="100" y="40" width="500" height="300" resizable="true">
<animator name="fadeout" attribute="opacity" to=".15" duration="500" start="false"/>
<animator name="fadein" attribute="opacity" from=".15" to="1" duration="500" start="false"/>
<animator name="leftesc" attribute="x" from="100" to="-900" duration="200" start="false"/>
<method event="oninit">
this.logonDelegate = new LzDelegate(this, "logonmethod" );
LzTimer.addTimer( this.logonDelegate, 2000 );
</method>
<method name="logonmethod">
this.fadeout.doStart();
letmein.open();
letmein.fadein.doStart();
</method>
<method name="out">
this.leftescDelegate = new LzDelegate(this, "leftout" );
LzTimer.addTimer( leftescDelegate, 5000 );
</method>
<method name="leftout">
quest.leftesc.doStart();
quest.destory();
</method>
<view x="${(immediateparent.width / 2)
- (this.width / 2)}" y="${(immediateparent.height / 2)
- (this.height / 2)}">
<text id="bye" fontsize="40" width="300"></text>
</view>
</window>
</canvas>
<canvas bgcolor="0xEAEAEA" height="600" width="800"
oninit="quest.setAttribute('haswindowfocus', true)">
<silverstyle isdefault="true" canvascolor="null"/>
<bluestyle name="bluecolors" canvascolor="null"/>
<goldstyle name="goldcolors" canvascolor="null"/>
<dataset name="checker" src="check.jsp" type="http"/>
<modaldialog id="letmein" height="200" width="300" x="180" y="100" style="bluecolors">
<animator name="fadein" attribute="opacity" from="0" to="1" duration="500" start="false"/>
<method name="doAfter">
quest.fadein.doStart();
bye.setAttribute('text','再见');
</method>
<form id="loginform">
<submit name="doSubmit" data="${checker}"/>
<view id="loginmain" align="center" layout="axis: y; spacing: 20">
<view layout="axis: x; spacing: 5">
<text y="2" >用户:</text>
<edittext width="120" id="username" name="username">哈哈</edittext>
</view>
<view layout="axis: x; spacing: 5">
<text y="2" >密码:</text>
<edittext id="password" width="120" name="password">123</edittext>
</view>
<view align="center" layout="axis:x; spacing:20" y="150">
<button>确认
<method event="onclick">
loginform.doSubmit.submit();
</method>
</button>
<button>取消
<method event="onclick">
letmein.close();
letmein.doAfter();
</method>
</button>
</view>
<datapointer id="respoint" xpath="checker:/response">
<method event="ondata">
if (this.xpathQuery("/response/text()")=="ok") {
letmein.close();
quest.fadein.doStart();
bye.setAttribute('text','欢迎'+username.getText());
quest.out();
}
else
err.open();
</method>
</datapointer>
</view>
</form>
</modaldialog>
<alert id="err">密码错误!</alert>
<window style="goldcolors" id="quest" title="神秘地带"
x="100" y="40" width="500" height="300" resizable="true">
<animator name="fadeout" attribute="opacity" to=".15" duration="500" start="false"/>
<animator name="fadein" attribute="opacity" from=".15" to="1" duration="500" start="false"/>
<animator name="leftesc" attribute="x" from="100" to="-900" duration="200" start="false"/>
<method event="oninit">
this.logonDelegate = new LzDelegate(this, "logonmethod" );
LzTimer.addTimer( this.logonDelegate, 2000 );
</method>
<method name="logonmethod">
this.fadeout.doStart();
letmein.open();
letmein.fadein.doStart();
</method>
<method name="out">
this.leftescDelegate = new LzDelegate(this, "leftout" );
LzTimer.addTimer( leftescDelegate, 5000 );
</method>
<method name="leftout">
quest.leftesc.doStart();
quest.destory();
</method>
<view x="${(immediateparent.width / 2)
- (this.width / 2)}" y="${(immediateparent.height / 2)
- (this.height / 2)}">
<text id="bye" fontsize="40" width="300"></text>
</view>
</window>
</canvas>
check.jsp部分
<?xml version="1.0" encoding="GBK"?>
<%...@ page import="java.util.*" %>
<%...@ page contentType="text/xml; charset=GBK" %>
<response>
<%...
String user = request.getParameter("username");
String password = request.getParameter("password");
String uuser = new String(user.getBytes("8859_1"), "UTF-8");
if(uuser.equals("haha")&&password.equals("123"))
out.print("ok");
%>
</response>
<%...@ page import="java.util.*" %>
<%...@ page contentType="text/xml; charset=GBK" %>
<response>
<%...
String user = request.getParameter("username");
String password = request.getParameter("password");
String uuser = new String(user.getBytes("8859_1"), "UTF-8");
if(uuser.equals("haha")&&password.equals("123"))
out.print("ok");
%>
</response>