Results 1 to 3 of 3

Thread: TypeError: g.body is null in the login page

  1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    304

    Default TypeError: g.body is null in the login page

    Hi,
    I have a strange error that appears on the login page while nothing has been changed in the file


    TypeError: g.body is null

    The login page is

    Code:
    <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="<c:url value='/ext/resources/css/ext-all.css'/>"/>
    <script type="text/javascript" src="<c:url value='/ext/adapter/ext/ext-base.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/ext/ext-all.js'/>"></script>
    <%@ include file="/WEB-INF/jsp/includes/extjs.jsp" %>
    <link rel="stylesheet" type="text/css" href="<c:url value='/ext/resources/css/yourtheme.css'/>"/>
    <link type="text/css" rel="stylesheet" href="<c:url value ='/css/login.css'/>"/>
    <title>
        <spring:message code="login.login"/> -
        <spring:message code="application.name"/>
        <spring:message code="application.version"/>
    </title>
    <link rel="icon" href="./img/favicon.ico" type="image/x-icon"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="expires" content="Mon, 22 Jul 2002 11:12:01 GMT"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    
    <script type="text/javascript">
    var questionRecord = Ext.data.Record.create([
        {name:'question'}
    ]);
    var questionDataStore = new Ext.data.Store({
        autoLoad:true,
        proxy:new Ext.data.ScriptTagProxy({
            url:'<c:url value="/user/getAnonPwdQuestions.htm"/>'
        }),
        reader:new Ext.data.JsonReader({
            root:'rows',
            totalProperty:'totalCount',
            id:'id'
        }, questionRecord)
    });
    
    function changePassword() {
        var winChangePassword = new Ext.Window({
            id:'changePasswordId',
            layout:'fit',
            width:500,
            height:370,
            plain:true,
            modal:true,
            iconCls:'securityIcon',
            title:'<spring:message code="application.changePassword"/>',
            items:{
                xtype:"form",
                id:"changePasswordForm",
                deferredRender:false,
                border:false,
                labelWidth:150,
                items:[
                    new Ext.Panel({
                        padding:'30 10 10 10',
                        items:[
                            {
                                xtype:"fieldset",
                                autoHeight:true,
                                items:[
                                    {
                                        xtype:"textfield",
                                        id:"loginCPssd",
                                        name:"login",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="application.login"/>',
                                        width:150,
                                        enableKeyEvents:true,
                                        helpText:'<spring:message code="application.login.help"/>',
                                        listeners:{
                                            keyup:function (field, evt) {
                                                field.setValue(field.getValue().toUpperCase())
                                            }
                                        }
                                    },
                                    {
                                        xtype:"textfield",
                                        id:"oldPassword",
                                        name:"oldPassword",
                                        inputType:'password',
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="application.oldPassword"/>',
                                        width:150,
                                        helpText:'<spring:message code="application.oldPassword.help"/>'
                                    },
                                    {
                                        xtype:"textfield",
                                        id:"newPassword",
                                        name:"newPassword",
                                        inputType:'password',
                                        vtype:'newPassword',
                                        oldPassField:'oldPassword',
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="application.newPassword"/>',
                                        width:150,
                                        helpText:'<spring:message code="application.newPassword.help"/>'
                                    },
                                    {
                                        xtype:"textfield",
                                        id:"confirmNewPassword",
                                        name:"confirmNewPassword",
                                        inputType:'password',
                                        vtype:'password',
                                        initialPassField:'newPassword',
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="application.confirmNewPassword"/>',
                                        width:150,
                                        helpText:'<spring:message code="application.confirmNewPassword.help"/>'
                                    },
                                    {
                                        xtype:'fieldset',
                                        title:'<spring:message code="captcha.image"/>',
                                        autoHeight:true,
                                        items:[
                                            {
                                                xtype:'component',
                                                id:'changePwdCaptchaPreview',
                                                name:'changePwdCaptchaPreview',
                                                autoEl:{
                                                    tag:'img',
                                                    align:'center',
                                                    id:'changePwdImgPreview',
                                                    width:150,
                                                    src:'./user/getAnonPwdCaptcha.htm' + '?_dc=' + (new Date().getTime())
                                                }
                                            }
                                        ]
                                    },
                                    {
                                        xtype:"textfield",
                                        id:"changePwdCaptchaVerif",
                                        name:"changePwdCaptchaVerif",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="captcha.verification"/>',
                                        width:230,
                                        helpText:'<spring:message code="captcha.verification.help"/>'
                                    }
                                ]
                            }
                        ]
                    })
                ]
            },
            buttons:[
                {
                    id:'changePasswordButtonOK',
                    text:'<spring:message code="action.OK"/>',
                    handler:function () {
                        var form = Ext.getCmp('changePasswordForm').getForm();
                        var actionUrl = "<c:url value="/user/updateAnonPwdUser.htm"/>";
                        var waitingMessage = '<spring:message code="application.changingPassword"/>';
                        var failureMessage = '<spring:message code="application.failure.changingPassword"/>';
                        var successMessage = '<spring:message code="application.success.changingPassword"/>';
    
                        form.submit({
                            url:actionUrl,
                            waitMsg:waitingMessage,
                            success:function (form, action) {
                                Ext.Msg.alert('<spring:message code="application.success"/>', successMessage);
                                winChangePassword.close();
                            },
                            failure:function (result, request) {
                                Ext.Msg.alert('<spring:message code="application.failure"/>', failureMessage);
                                document.getElementById('changePwdImgPreview').src = './user/getAnonPwdCaptcha.htm' + '?_dc=' + (new Date().getTime());
                            }
                        })
                    }
                },
                {
                    id:'changePasswordButtonCancel',
                    text:'<spring:message code="action.cancel"/>',
                    handler:function () {
                        winChangePassword.close();
                    }
                }
            ]
        });
        winChangePassword.show();
    }
    
    function resetPassword() {
        var winResetPassword = new Ext.Window({
            id:'resetPasswordId',
            layout:'fit',
            title:'<spring:message code="application.resetPassword"/>',
            width:500,
            height:350,
            iconCls:'securityIcon',
            plain:true,
            modal:true,
            items:{
                xtype:"form",
                id:"resetPasswordForm",
                deferredRender:false,
                border:false,
                labelWidth:150,
                items:[
                    new Ext.Panel({
                        padding:'30 10 10 10',
                        items:[
                            {
                                xtype:"fieldset",
                                autoHeight:true,
                                items:[
                                    {
                                        xtype:"textfield",
                                        id:"loginRPssd",
                                        name:"login",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="application.login"/>',
                                        width:150,
                                        enableKeyEvents:true,
                                        helpText:'<spring:message code="application.login.help"/>',
                                        listeners:{
                                            keyup:function (field, evt) {
                                                field.setValue(field.getValue().toUpperCase())
                                            }
                                        }
                                    },
                                    new Ext.form.ComboBox({
                                        fieldLabel:'<spring:message code="application.questions"/>',
                                        hiddenName:"questionId",
                                        name:"question",
                                        id:"question",
                                        store:questionDataStore,
                                        displayField:'question',
                                        valueField:'question',
                                        typeAhead:true,
                                        selectOnFocus:true,
                                        forceSelection:true,
                                        triggerAction:'all',
                                        helpText:'<spring:message code="application.questions.help"/>'
                                    }),
                                    {
                                        xtype:"textfield",
                                        id:"answer",
                                        name:"answer",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="application.answer"/>',
                                        width:230,
                                        enableKeyEvents:true,
                                        helpText:'<spring:message code="application.answer.help"/>',
                                        listeners:{
                                            keyup:function (field, evt) {
                                                field.setValue(field.getValue().toUpperCase())
                                            }
                                        }
                                    },
                                    {
                                        xtype:'fieldset',
                                        title:'<spring:message code="captcha.image"/>',
                                        autoHeight:true,
                                        items:[
                                            {
                                                xtype:'component',
                                                id:'resetPwdCaptchaPreview',
                                                name:'resetPwdCaptchaPreview',
                                                autoEl:{
                                                    tag:'img',
                                                    align:'center',
                                                    id:'resetImgPreview',
                                                    width:150,
                                                    src:'./user/getAnonPwdCaptcha.htm' + '?_dc=' + (new Date().getTime())
                                                }
                                            }
                                        ]
                                    },
                                    {
                                        xtype:"textfield",
                                        id:"resetPwdCaptchaVerif",
                                        name:"resetPwdCaptchaVerif",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="captcha.verification"/>',
                                        width:230,
                                        helpText:'<spring:message code="captcha.verification.help"/>'
                                    }
                                ]
                            }
                        ]
                    })
                ]
            },
            buttons:[
                {
                    id:'resetPasswordButtonOK',
                    text:'<spring:message code="action.OK"/>',
                    handler:function () {
                        var form = Ext.getCmp('resetPasswordForm').getForm();
                        var actionUrl = "<c:url value="/user/resetAnonPwdUser.htm"/>";
                        var waitingMessage = '<spring:message code="application.resetingPassword"/>';
                        var failureMessage = '<spring:message code="application.failure.resetingPassword"/>';
                        var successMessage = '<spring:message code="application.success.resetingPassword"/>';
                        form.timeout = 0;
                        form.submit({
                            url:actionUrl,
                            waitMsg:waitingMessage,
                            success:function (form, action) {
                                Ext.Msg.alert('<spring:message code="application.success"/>', successMessage);
                                winResetPassword.close();
                            },
                            failure:function (result, request) {
                                Ext.Msg.alert('<spring:message code="application.failure"/>', failureMessage);
                                document.getElementById('resetImgPreview').src = './user/getAnonPwdCaptcha.htm' + '?_dc=' + (new Date().getTime());
                            }
                        })
                    }
                },
                {
                    id:'resetPasswordButtonCancel',
                    text:'<spring:message code="action.cancel"/>',
                    handler:function () {
                        winResetPassword.close();
                    }
                }
            ]
        });
        winResetPassword.show();
    }
    
    
    function userHelp() {
        var userHelpWin = new Ext.Window({
            id:'userHelpWin',
            layout:'fit',
            width:450,
            height:438,
            plain:true,
            modal:true,
            iconCls:'helpIcon',
            title:'<spring:message code="msgbox.helpdesk.title"/>',
            items:{
                xtype:"form",
                id:"userHelpForm",
                deferredRender:false,
                border:false,
                labelWidth:150,
                //errorReader:new Ext.form.XmlErrorReader(),
                items:[
                    new Ext.Panel({
                        padding:'10 10 10 10',
                        items:[
                            {
                                xtype:"fieldset",
                                title:'<spring:message code="msgbox.helpdesk.central"/>',
                                autoHeight:true,
                                items:[
                                    {
                                        xtype:"displayfield",
                                        id:"centralNote",
                                        name:"centralNote",
                                        hideLabel:true,
                                        value:'<spring:message code="msgbox.helpdesk.central.note"/>'
                                    },
                                    {
                                        xtype:"displayfield",
                                        id:"centraltel",
                                        name:"centraltel",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="msgbox.helpdesk.central.tel"/>',
                                        width:150,
                                        value:'<spring:message code="msgbox.helpdesk.central.tel.val"/>'
                                    },
                                    {
                                        xtype:"displayfield",
                                        id:"centralfax",
                                        name:"centralfax",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="msgbox.helpdesk.central.fax"/>',
                                        width:150,
                                        value:'<spring:message code="msgbox.helpdesk.central.fax.val"/>'
                                    },
                                    {
                                        xtype:"displayfield",
                                        id:"centralemail",
                                        name:"centralemail",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="msgbox.helpdesk.email"/>',
                                        width:150,
                                        value:'<spring:message code="msgbox.helpdesk.email.val"/>'
                                    }
                                ]
                            },
                            {
                                xtype:"fieldset",
                                title:'<spring:message code="msgbox.helpdesk.northam"/>',
                                autoHeight:true,
                                items:[
                                    {
                                        xtype:"displayfield",
                                        id:"northamtel",
                                        name:"northamtel",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="msgbox.helpdesk.central.tel"/>',
                                        width:150,
                                        value:'<spring:message code="msgbox.helpdesk.northam.tel.val"/>'
                                    },
                                    {
                                        xtype:"displayfield",
                                        id:"northamfax",
                                        name:"northamfax",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="msgbox.helpdesk.central.fax"/>',
                                        width:150,
                                        value:'<spring:message code="msgbox.helpdesk.northam.fax.val"/>'
                                    }
                                ]
                            },
                            {
                                xtype:"fieldset",
                                title:'<spring:message code="msgbox.helpdesk.latina"/>',
                                autoHeight:true,
                                items:[
                                    {
                                        xtype:"displayfield",
                                        id:"latina",
                                        name:"latina",
                                        allowBlank:false,
                                        fieldLabel:'<spring:message code="msgbox.helpdesk.central.tel"/>',
                                        width:150,
                                        value:'<spring:message code="msgbox.helpdesk.latina.fax"/>'
                                    }
                                ]
                            }
                        ]
                    })
                ]
            },
            buttons:[
                {
                    text:'<spring:message code="action.OK"/>',
                    handler:function () {
                        userHelpWin.close();
                    }
                }
            ]
        });
    
        userHelpWin.show();
    }
    
    function changeToUpperCase(e) {
        e.value = e.value.toUpperCase();
    }
    
    function getLoginWarnings() {
        Ext.Ajax.request({
            url:'<c:url value="/user/getLogingWarnings.htm"/>',
            method:'GET',
            timeout:0,
            success:function (response, opts) {
                var results = Ext.decode(response.responseText, true);
                if (response.responseText.match("success=\"false\"") != null) {
                    Ext.Msg.alert('<spring:message code="application.failure"/>', '<spring:message code="application.error.warningMessage"/>');
                } else {
                    var records = results.records;
                    if (results != undefined && records != undefined && records instanceof Array && records.length > 0) {
                        displayLoginWarningMessageWindow(records);
                    }
    
                }
            },
            failure:function (response, opts) {
                Ext.Msg.alert('<spring:message code="application.failure"/>', '<spring:message code="application.error.warningMessage"/>');
            }
        });
    }
    
    function displayLoginWarningMessageWindow(records) {
        var data = new Array();
        var record;
        for (var i = 0; i < records.length; i++) {
            record = new Array(records[i].id, records[i].label);
            data.push(record)
        }
    
    
        var store = new Ext.data.ArrayStore({
            data:data,
            fields:[
                {name:'subject'},
                {name:'description'}
            ]
        });
    
        var subject = function (subject) {
            var template = "<p style='white-space:normal'>{0}</p>";
            return String.format(template, subject);
        };
    
        var description = function (description, column, record) {
            var template = "<p style='white-space:normal'>{0}</p>";
            return String.format(template, description);
        };
        var columnModel = [
            { header:'<spring:message code="enableWarning.subject"/>',
                dataIndex:'subject',
                width:125,
                renderer:subject
            },
            { header:'<spring:message code="enableWarning.description"/>',
                dataIndex:'description',
                renderer:description,
                width:350
            }
        ];
        var grid = {
            xtype:'grid',
            columns:columnModel,
            store:store,
            height:200,
            width:500
        };
    
    
        var win = new Ext.Window({
            layout:'fit',
            width:500,
            height:200,
            minWidth:500,
            minHeight:200,
            plain:true,
            autoScroll:true,
            iconCls:'warningMessage',
            title:'<spring:message code="enableWarning.title"/>',
            items:{
                xtype:'form',
                layout:'fit',
                height:200,
                width:500,
                items:grid
            },
            buttons:[
                {
                    text:'<spring:message code="action.OK"/>',
                    handler:function () {
                        win.close();
                    }
                }
            ]
        });
        win.show();
    }
    getLoginWarnings();
    </script>
    </head>
    <body onload='document.f.j_username.focus();'>
    <c:if test="${not empty SPRING_SECURITY_LAST_EXCEPTION.message}">
        <script type="text/javascript">
            var springSecurityLastExceptionMsg = "<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>";
            if (springSecurityLastExceptionMsg == "User credentials have expired")
                springSecurityLastExceptionMsg = springSecurityLastExceptionMsg + ". Please, change your password!";
            if (springSecurityLastExceptionMsg == "User account is locked")
                springSecurityLastExceptionMsg = springSecurityLastExceptionMsg + ". Please, reset your password!";
            if (springSecurityLastExceptionMsg == "User account has expired")
                springSecurityLastExceptionMsg = springSecurityLastExceptionMsg + ". Please, contact the helpdesk!";
    
            <c:remove scope="session" var="SPRING_SECURITY_LAST_EXCEPTION"/>
            Ext.MessageBox.show({
                title:'<spring:message code="login.failed"/>',
                msg:'<spring:message code="login.failed.niceErrorFeedback"/>' + springSecurityLastExceptionMsg,
                buttons:Ext.MessageBox.OK,
                icon:'error',
                fn:function () {
                    if (springSecurityLastExceptionMsg == "User credentials have expired. Please, change your password!")
                        changePassword();
                    if (springSecurityLastExceptionMsg == "User account is locked. Please, reset your password!")
                        resetPassword();
                    if (springSecurityLastExceptionMsg == "User account has expired. Please, contact the helpdesk!")
                        userHelp();
                }
            });
    
        </script>
    </c:if>
    
    <c:if test="${not empty model.messageBrowserAuthorisation}">
        <script type="text/javascript">
            Ext.MessageBox.show({
                title:'<spring:message code="login.browserNotCompliant"/>',
                msg:'${model.messageBrowserAuthorisation}',
                buttons:Ext.MessageBox.OK,
                icon:'error'
            });
        </script>
    </c:if>
    <c:if test="${empty model.messageBrowserAuthorisation}">
        <form name='f' action="./j_spring_security_check" method='POST'>
            <table cellpadding="0" cellspacing="0" id="fullheight">
                <tr>
                    <td align="center" valign="top">
                        <table cellpadding="0" cellspacing="0" id="table_contenu">
                            <tr>
                                <td align="center" valign="top"><img src="./img/left.jpg" width="125" height="1100" alt=""/>
                                </td>
                                <td align="center" valign="top" class="header">
                                    <table cellpadding="0" cellspacing="10" width="495">
                                        <tr>
                                            <td valign="top" align="left"><img src="./img/logo.png" width="400" height="165"
                                                                               alt=""/></td>
                                        </tr>
                                        <tr>
                                            <td valign="top" align="left" class="title"><spring:message
                                                    code="login.login"/></td>
                                        </tr>
                                        <tr>
                                            <td valign="top" align="left">
                                                <label for="j_username"><spring:message code="application.login"/></label>
                                                <input class="input_form" type="text" id="j_username" name="j_username"
                                                       autocomplete="off" onkeyup="changeToUpperCase(this)"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" align="left">
                                                <label for="j_password"><spring:message code="login.password"/></label>
                                                <input class="input_form" type="password" id="j_password" name="j_password"
                                                       autocomplete="off"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" align="left">
                                                <label for="token"><spring:message
                                                        code="login.token"/> ${model.tokenX}${model.tokenY}</label>
                                                <input class="input_form" type="text" id="token" name="token"
                                                       autocomplete="off"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" align="left">
                                                <input class="input_submit" type="submit"
                                                       value="<spring:message code="login.connect"/>"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" align="left" class="footer">
                                                <table cellpadding="0" cellspacing="0" width="100%">
                                                    <tr>
                                                        <td valign="top" align="center" class="btn_link"><a
                                                                id="changePassword" onclick="changePassword();"
                                                                href="#"><spring:message code="login.changePassword"/></a>
                                                        </td>
                                                        <td valign="top" align="center" class="btn_link"><a
                                                                id="forgotPassword" onclick="resetPassword();"
                                                                href="#"><spring:message code="login.forgotPassword"/></a>
                                                        </td>
                                                        <td valign="top" align="center" class="btn_link"><a
                                                                onclick="userHelp();" href="#"><spring:message
                                                                code="login.help"/></a>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td align="center" valign="top"><img src="./img/right.jpg" width="125" height="1100"
                                                                     alt=""/>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </form>
    </c:if>
    </body>
    </html>

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    549

    Default

    Can you not limit the error to a specific section by methodically removing / reinstating pieces of code?

    Does the Firebug console not raise any other errors?

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410

    Default

    Please present a working test case that is usable. Also.. have you created a break point at the location of the error to see what is going on?

    possible cause: nesting form inside another form

    Scott.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •