خرید بک لینک

Vote count: 0

I am new using ExtJS. I have created a login form, on Submit the parameter values should be passed to Servlet. Even the servlet is getting called, the value passing is null. Attaching the code snippet below, please help me in debugging the error.

login.js

Ext.application({
name: 'test-application',
launch: function() {

    Ext.QuickTips.init();

    var login_details = Ext.create('Ext.form.Panel', {
        frame: true,
        xtype: 'fieldset',
        padding: 10,
        layout: 'anchor',
        fieldDefaults: {
            msgTarget: 'side',
            labelWidth: 50
        },
        defaultType: 'textfield',
        defaults: {
            anchor: '100%'
        },
        items: [{
                xtype: 'fieldset',
                title: 'Login',
                defaultType: 'textfield',
                layout: 'anchor',
                defaults: {
                    anchor: '100%'
                },
                items: [{
                        xtype: 'container',
                        columnWidth: 1,
                        layout: 'anchor',
                        items: [{
                                xtype: 'textfield',
                                labelAlign: 'top',
                                fieldLabel: 'Useame',
                                name: 'useame',
                                id: 'useame',
                                allowBlank: false,
                                padding: '0 0 10 0',
                                anchor: '60%'
                            }, {
                                xtype: 'textfield',
                                labelAlign: 'top',
                                fieldLabel: 'Password',
                                inputType: 'password',
                                name: 'password',
                                id:'password',
                                allowBlank: false,
                                padding: '0 0 10 0',
                                anchor: '60%'
                            }]
                    }]
            }],
        buttons: [{
                text: 'Login',
                handler: function()
                {
                    Ext.Ajax.request({
                        url: '/TestSystem/LoginServlet',
                        method: 'POST'
                    });
                    var formData = this.up('form').getForm();
                    formData.submit();
                }
            },
            {
                text: 'Reset Form',
                handler: function() {
                    this.up('form').getForm().reset();
                }
            }]
    });

    var login_panel = new Ext.Panel({
        region: 'center',
        align: 'stretch',
        title: 'Test Automation',
        items: [login_details]
    });

    Ext.create('Ext.container.Viewport', {
        layout: 'fit',
        items: [{
                layout: 'border',
                defaults: {
                    collapsible: false,
                    collapsed: false,
                    split: false,
                    bodyStyle: 'padding:2px'
                },
                items: [{
                        region: 'north',
                        height: 150,
                        minSize: 75,
                        maxSize: 250,
                        cmargins: '0 0 0 0',
                        border: false
                    }, {
                        region: 'west',
                        width: 450,
                        minSize: 100,
                        maxSize: 250,
                        border: false
                    }, {
                        region: 'center',
                        align: 'stretch',
                        border: false,
                        layout: {
                            type: 'fit',
                            align: 'stretch'
                        },
                        items: [login_panel]
                    },
                    {
                        region: 'east',
                        width: 450,
                        minSize: 100,
                        maxSize: 150,
                        bodyStyle: 'padding:0px',
                        border: false
                    },
                    {
                        region: 'south',
                        width: 225,
                        height: 300,
                        minSize: 100,
                        maxSize: 250,
                        bodyStyle: 'padding:0px',
                        border: false
                    }
                ]
            }],
        renderTo: Ext.getBody()
    });
}
});

LoginServlet.java

package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.aotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

 /**
  * @author Bijoy
 */

 @WebServlet(description = "Servlet used to validate users", urlPattes = { "/LoginServlet" })
public class LoginServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    response.setContentType("text/html");

    String useame = request.getParameter("useame");
    String password = request.getParameter("password");
    System.out.println("Useame from UI : " + useame);
    System.out.println("Password from UI : " + password);
    }
}

I am using extjs-4.2.2

asked 31 secs ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 20 تير 1395 ساعت: 19:28

صفحه بندی