1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    31
    Vote Rating
    0
    priyapratheep is on a distinguished road

      0  

    Default integrating ExtJs and struts

    integrating ExtJs and struts


    In my program I am integrating ExtJS with struts.

    From JSP I am uploading a file through struts. Two days I am googling and tried many different ways. Here is my code

    ExtJS
    Code:
        var csDocPanel = new Ext.form.FormPanel({
               standardSubmit: true,
               frame:true,
               title: 'Costing Sheet Documents',
               width: 970,
                bodyStyle:'padding:5px 5px 0',
               defaultType: 'textfield',
                method:    'post',
        items: [{
                       id:'sendFileFieldId',
            name:        'sendFileField',
            labelStyle:    'martin:5px;padding:5px;width:200px',
            inputType:    'file',
            border:    false
                 }],
               buttons: [{
                    text: 'Submit',
                    handler: function(button, event) {
                        csDocPanel.getForm().submit({
                            action:'UploadAndSaveCsDocAction.action',
                            method:'POST',         
                            failure: function() {
                                    Ext.Msg.alert('Error', 'Can not save data.');
                                }
                        });
                }
            }]
     
    });

    My struts-config.xml file
    Code:
            <action attribute="UploadFileFormCsDoc" name="DynaFormBean" path="/apse-projectmgmt-portlet/FileUploadAndSaveCsDoc" 
                type="com.bmtap.apse.projectmgmt.action.UploadAndSaveCsDocAction"  scope="request" input="/jsp/view.jsp"> 
                <forward name="success" path="/jsp/project_costingsheet1.jsp" redirect="true"/>
                <forward name="failure" path="/jsp/project_costingsheet1.jsp" redirect="true"/>
            </action>
    My action class
    Code:
    public class UploadAndSaveCsDocAction extends Action {
        
        private Logger logger = LogManager.getLogger(UploadAndSaveCsDocAction.class);
        
        public ActionForward execute( ActionMapping mapping, ActionForm form, 
                HttpServletRequest request, HttpServletResponse response) throws Exception{ 
    .....
    }
    I tried many ways like
    1.
    Code:
    function doPostSend(){
            csDocPanel.getForm().submit({
            url:"/apse-projectmgmt-portlet/FileUploadAndSaveCsDoc.do",
            success: function (form, action)    {    
                alert( "success"); 
                                },
            failure: function (form, action)    {    
                alert("failure"); 
                }
            })
            ;}
    I got error 404 can't find /apse-projectmgmt-portlet/FileUploadAndSaveCsDoc.do

    2.
    Code:
    var csDocPanelTemp = new Ext.FormPanel({
        id:            'csDocPanelTemp',
        frame:true,
        title: 'Costing Sheet Documents',
        bodyStyle:'padding:5px 5px 0',
        width: 970,
        items:         [fileField,csDocGrid],
           autoWidth:    true,
        fileUpload:    true,
        standardSubmit: true,
        isUpload:     true,
        //url:'UploadFileFormCsDoc.action', 
        
        url:        "/apse-projectmgmt-portlet/FileUploadAndSaveCsDoc.do",
        action : this.url || '',
        method:        'post'
        
    });
    and many...

    Most of the error i am getting is can't file the path /apse-projectmgmt-portlet/FileUploadAndSaveCsDoc.do

    But when I try this with the below code I can upload the file successfully
    Code:
      <html:form method="post"  action="/apse-projectmgmt-portlet/FileUploadAndSaveCsDoc.do"  enctype="multipart/form-data" > 
        <table> 
        
        <tr class="fieldlabel">
            <td align="left"> <html:file property="theFile"/> <font color="red"><html:errors/></font> </td> 
        </tr>
        <tr> 
            <td align="center" colspan="2"> <html:submit>Upload File</html:submit> </td> 
        </tr>     
    </table> 
    </html:form>
    Any body please help me .Thanks in advance

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,911
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    This seems to be a duplicate of:
    http://www.sencha.com/forum/showthread.php?205116

    Regards,
    Scott.

Thread Participants: 1

Tags for this Thread

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