BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / www-technology / #34452同步于 2016/3/10
WWWTechnology机器人发帖

extjs首次进入登录页面验证码无法加载,登陆后退出再进入登录页

onespark
2016/3/10镜像同步0 回复
首次打开登录页面,验证码显示不出来 在登录过系统一遍后,退出系统再次打开登录压面验证码可以显示出来。 求大神指导,项目用的是SSH框架, 首次进入登录页面的时候,返回值存在问题,并没有执行生成验证码的java文件,等过系统之后退出系统再次进入登录页面,返回值正常,这时候才执行了生成验证码的java文件。我觉得是有什么环节出了问题,导致登录系统之前,生成验证码的函数没办法执行。 structs.xml里的配置如下: <!-- 验证码 --> <action name="validateCode" class="com.refeiner.action.uijumpandlogin.RandomAction"> <result name ="success" type="stream"> <param name="contentType">image/jpeg</param> <param name="inputName">inputStream</param> </result> </action> 下面是登录界面.js代码 Ext.onReady(function() { Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'side'; // initComponent : function() { //创建一个类,用于创建所需的验证码字段 Ext.define('Hongbo.view.CheckCode', { extend:'Ext.form.field.Text', alias:'widget.checkcode', inputTyle : 'codefield', codeUrl : Ext.BLANK_IMAGE_URL, // URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images isLoader:true, onRender:function (ct, position) { this.callParent(arguments); this.codeEl = ct.createChild( { tag:'img', src:Ext.BLANK_IMAGE_URL, title:'点击更换图片' }); this.codeEl.addCls('x-form-code'); this.codeEl.on('click', this.loadCodeImg, this); if (this.isLoader) { this.loadCodeImg(); } }, loadCodeImg:function () { this.codeEl.set( { src:this.codeUrl + '?id=' + Math.random() }); } }); var checkcode = Ext.create('Hongbo.view.CheckCode', { // cls:'key', xtype:'textfield', name:'pageCheckCode', id:'randCode', fieldLabel:'验证码', labelWidth:40, allowBlank:false, blankText:'验证码不能为空', codeUrl:'validateCode', msgTarget:'side', enableKeyEvents:true, }); var loginForm = Ext.create('Ext.form.Panel', { bodyStyle:'background: #cdcdcd;padding:5px 5px 0;', border : false, fieldDefaults: { msgTarget: 'side', labelWidth: 40}, //defaultType: 'textfield', // defaults: {anchor: '100%'}, items: [{ xtype: 'textfield', fieldLabel: '帐号', maxLength: 15, name: 'imeiNumber', //allowBlank:false, blankText : '请输入账号', emptyText:'yzq', maxLengthText: '密码不能超过15个字符', anchor: '100%' }, { xtype: 'textfield', fieldLabel: '密码', name: 'pw', inputType : 'password', allowBlank:false, blankText : '请输入密码', anchor: '100%' },checkcode ] }); var loginWindow = Ext.create('Ext.window.Window',{ title : '通信勘察系统登录', items : [loginForm], width : 330, layout : 'fit', //自适应布局 align : 'center', x:900, y:200, resizable : false, draggable : false, border : false, bodyStyle : 'padding:5px;background:gray', maximizable : false, closeAction : 'close', closable : false, plain : true, iconCls: 'loginicon', layout : 'fit', //自适应布局 align : 'center', buttonAlign : 'center', buttons: [{ text: '登录', handler : function(){ if (loginForm.form.isValid()) { loginForm.form.submit({ waitTitle : '请稍候', waitMsg : '正在登录......', //method : 'post', url : 'processLoginJson', //提交到servlet地址 success : function(form, action) { Ext.Msg.alert('系统提示',action.result.retmsg); window.location.href = "processLoginJump"; }, failure : function(form, action) { Ext.Msg.alert('系统提示',action.result.retmsg); } }); } } },{ text: '重置', handler : function(){ loginForm.form.reset(); } }] }); loginWindow.show(); });
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。