1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    8
    Vote Rating
    0
    extjsnb is on a distinguished road

      0  

    Default Unanswered: Can't get servlet to be invoked by extjs javascript code

    Unanswered: Can't get servlet to be invoked by extjs javascript code


    Hello,

    I have a webapp using java, extjs deployed in Tomcat. I am trying to call a servlet from a js. I can call the servlet directly and it comes up. But extjs cannot. Please help!!

    index.js:

    /*

    This file is part of Ext JS 4

    Copyright (c) 2011 Sencha Inc

    Contact: http://www.sencha.com/contact

    GNU General Public License Usage
    This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.

    If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.

    */
    Ext.require([
    'Ext.form.*',
    'Ext.layout.container.Absolute',
    'Ext.window.Window'
    ]);

    Ext.onReady(function() {
    var form = Ext.create('Ext.form.Panel', {
    layout: 'absolute',
    url: 'test3',
    defaultType: 'textfield',
    border: false,

    items: [{
    fieldLabel: 'Send To',
    fieldWidth: 60,
    msgTarget: 'side',
    allowBlank: false,
    x: 5,
    y: 5,
    name: 'to',
    anchor: '-5' // anchor width by percentage
    }, {
    fieldLabel: 'Subject',
    fieldWidth: 60,
    x: 5,
    y: 35,
    name: 'subject',
    anchor: '-5' // anchor width by percentage
    }, {
    x:5,
    y: 65,
    xtype: 'textarea',
    style: 'margin:0',
    hideLabel: true,
    name: 'msg',
    anchor: '-5 -5' // anchor width and height
    }]
    });

    var win = Ext.create('Ext.window.Window', {
    title: 'Resize Me',
    width: 500,
    height: 300,
    minWidth: 300,
    minHeight: 200,
    layout: 'fit',
    plain:true,
    items: form,


    buttons: [{
    text: 'Reset',
    handler: function() {
    this.up('form').getForm().reset();
    }
    }, {
    text: 'Submit',
    handler: function() {
    Ext.MessageBox.alert('Submitted Values', 'Submitted Values');

    this.up('form').getForm().submit();
    }
    }]


    });

    win.show();
    });




    web.xml

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsichemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
    <servlet>
    <servlet-name>Test</servlet-name>
    <servlet-class>test.FileUploadTest</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Test</servlet-name>
    <url-pattern>/test3</url-pattern>
    </servlet-mapping>
    </web-app>


    I can bring up the servlet with: http://localhost:8080/TestExtJs/test3


    But in index.js (shown above), I have

    url: 'test3',

    and in the button handler for the submit button, I have:

    this.up('form').getForm().submit();

    Shouldn't this submit the form and call test3?

    Please help...I must be overlooking something simple!

    Thanks in advance.
    Last edited by extjsnb; 8 Aug 2011 at 6:01 AM. Reason: solved!

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    8
    Vote Rating
    0
    extjsnb is on a distinguished road

      0  

    Default This has been solved!

    This has been solved!


    This has been solved. I simplified the code and it worked just as the examples showed.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    4
    Vote Rating
    0
    viniciusmelo is on a distinguished road

      0  

    Default


    Do you get some response from that servlet?

    I started another thread about something like this, in my case I'm trying to read the response in HTML not in JSON, which seems to be the standard ...

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi