1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    4
    Vote Rating
    0
    pravallika.esarla is on a distinguished road

      0  

    Default Unanswered: values not getting passed to servlet

    Unanswered: values not getting passed to servlet


    Hi i'm passing values from extjs page to servlet on clicking a button ..... the request is going to the servlet but values are being shown as null ...please help me ... thanks in advance


    VIDEO.JS

    Ext.Loader.setConfig({
    enabled: true
    });


    var formPanel ={
    xtype : 'form',
    height : 300,
    autoScroll : true,
    region : "center",
    id : 'formpanel',
    defaultType : 'field',
    frame : true,
    title : 'form panel',
    items :
    [
    {
    xtype: 'label',
    text: ''
    },
    {
    width :500,
    xtype: 'localVideoSearch',
    flex: 1
    },


    {
    xtype:'textfield',
    fieldLabel: 'Title',
    name: 'title',
    id: 'title',
    allowBlank:false
    },
    {
    xtype:'textfield',
    fieldLabel: 'Description',
    name: 'description',
    id: 'description',
    allowBlank:false
    },
    {
    xtype:'textfield',
    fieldLabel: 'keywords',
    name: 'keywords',
    id: 'keywords',
    allowBlank:false
    },
    {
    xtype:'textfield',
    fieldLabel: 'path',
    name: 'path',
    id: 'path',
    allowBlank:false
    },
    {
    xtype:'button',
    name:'submit',
    text:'Submit',
    handler: function()
    {


    Ext.Ajax.request({
    url: '/online_tv_scheduler/main/VideoServlet2',
    method: 'POST',
    });
    }
    }
    ],
    };
    Ext.application({
    name: 'VIDEOCOMBO',
    appFolder: 'app',
    autoCreateViewport: false,
    controllers: [
    'Videos'
    ],
    launch: function() {
    Ext.create('Ext.container.Viewport', {

    standardSubmit: true,
    frame: true,
    items: [
    formPanel
    ],

    });
    }

    });




    VIDEOSERVLET2.java


    package online_tv_scheduler.main;


    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;


    import online_tv_scheduler.beans.Artist;
    import online_tv_scheduler.utility.ArtistUtility;


    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;


    @WebServlet("/VideoServlet2")
    public class VideoServlet2 extends javax.servlet.http.HttpServlet
    {
    private static final long serialVersionUID = 1L;


    public VideoServlet2() {

    super();
    // TODO Auto-generated constructor stub
    System.out.println("int ot servlet ");
    }






    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    doPost(request,response);
    }


    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    System.out.println("in to doPost of video servlet 2 ");
    response.setContentType("text/html");
    String name = request.getParameter("title");
    String description = request.getParameter("description");
    String keywords = request.getParameter("keywords");
    System.out.println(" "+name+" "+description);
    }


    }

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,979
    Vote Rating
    212
    Answers
    476
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    I would recommend looking at the example form set up at the top of the form panel's API doc under the Example Usage sub-section. It has an example of how you can POST your form fields' values up to a server.
    http://docs.sencha.com/extjs/4.2.0/#...Ext.form.Panel

Thread Participants: 1

Tags for this Thread