1. EXT提交服务器的三种方式 1, EXT的form表单ajax提交(默认提交方式)
相对单独的ajax提交来说优点在于能省略写参数数组
将按钮添加单击事件,执行以下方法
java 代码
- function login(item) {
-
- if (validatorForm()) {
-
- this.disabled = true;
-
-
- formPanl.form.doAction('submit', {
-
- url : 'user.do?method=login',
-
- method : 'post',
-
-
- params : '',
-
-
- success : function(form, action) {
-
- Ext.Msg.alert('操作', action.result.data);
- this.disabled = false;
-
- },
- failure : function(form, action) {
-
- Ext.Msg.alert('警告', '用户名或密码错误!');
-
- this.disabled = false;
-
- }
- });
- this.disabled = false;
- }
- }
2.EXT表单的非ajax提交
在表单需加入下列代码
代码
-
-
- this.getEl().dom.action ='user.do?method=login'; this.getEl().dom.method = 'post';
-
- this.getEl().dom.submit();
- },
3.EXT的ajax提交
代码
-
-
- Ext.Ajax.request({
-
- url: 'login.do',
-
- params: {
- LoginName:Ext.get('LoginName').dom.value,
- LoginPassword:Ext.get('LoginPassword').dom.value
- },
-
- success: function(response, options) {
-
- var responseArray = Ext.util.JSON.decode(response.responseText);
- if(responseArray.success==true){
- Ext.Msg.alert('恭喜','您已成功登录!');
- }
- else{
- Ext.Msg.alert('失败','登录失败,请重新登录');
- }
- }
- });
2. 利用viewport布局左边区域系统菜单跳转两种方式
1,使用Ext.get('centerPanel').load(url:"aaa.jsp");url为必选参数还有其他可选参数 请参见api文档。缺点,加入的页面js无效 2,使用iframe,具体
js 代码
Ext.get('centerPanel').dom.innerHTML='< i f r a m e src=aaa.jsp>< / i f r a m e >';
优 点可以在载入的页面动态加载js脚本(推荐使用)
|