1. #1
    Sencha User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    mikkushukla is on a distinguished road

      0  

    Exclamation Unanswered: Exts filefield IE8 Spring 3 (Exception thrown not caught) Line: 4898 extjs-all-debug

    Unanswered: Exts filefield IE8 Spring 3 (Exception thrown not caught) Line: 4898 extjs-all-debug


    Hi Team,
    I have created a simple extjs form with filefield control. On server side I am using Spring MVC.
    My application running perfeclty fine firefox and mozilla.

    In case of IE 6/7/8. It is submittng form but with error and error is
    Exception thrown not caught
    Line: 4898 extjs-all-debug.js

    I have googled it like anything but no clue about this error.

    For your simplicity here is the demo
    Login to

    http://122.160.226.254:8080/promoteIt

    username : shukla
    password : miks

    on left menu click Site->Wap Site
    click on edit wap page icon
    then submit the page you get the error in IE 6/7/8.
    I think it is a bug.

    Rest you see.


    Thanks
    Shubhanshu Shukla
    Senior Software Engineer.

  2. #2
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92
    Vote Rating
    0
    mkariti is on a distinguished road

      0  

    Default


    mikkushukla,
    Can you please let me know how did you fix this?
    Im running to the same problem.
    Cheers
    mkariti

  3. #3
    Sencha User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    mikkushukla is on a distinguished road

      0  

    Default Here is the solutions.

    Here is the solutions.


    Just avoid using this kind of approach in spring controller...

    Code:
        @RequestMapping(method = RequestMethod.POST)
        public @ResponseBody String create(FileUploadBean uploadItem, BindingResult result){
    
            ExtJSFormResult extjsFormResult = new ExtJSFormResult();
    
            if (result.hasErrors()){
                for(ObjectError error : result.getAllErrors()){
                    System.err.println("Error: " + error.getCode() +  " - " + error.getDefaultMessage());
                }
    
                //set extjs return - error
                extjsFormResult.setSuccess(false);
    
                return extjsFormResult.toString();
            }
    
            // Some type of file processing...
            System.err.println("-------------------------------------------");
            System.err.println("Test upload: " + uploadItem.getFile().getOriginalFilename());
            System.err.println("-------------------------------------------");
    
            //set extjs return - sucsess
            extjsFormResult.setSuccess(true);
    
            return extjsFormResult.toString();
        }
    Correct Way for writing file upload controller is

    Code:
        public void create(FileUploadBean uploadItem, BindingResult result,HttpServletResponse response){
             ExtJSFormResult extjsFormResult = new ExtJSFormResult();
             if (result.hasErrors()){
                for(ObjectError error : result.getAllErrors()){
                    System.err.println(“Error: ” + error.getCode() +  ” – ” + error.getDefaultMessage());
                }
                //set extjs return – error
                extjsFormResult.setSuccess(false);
                response.setContentType(‘text/html’) ;
                response.getWriter().write(extjsFormResult.toString());
                response.flushBuffer();
                 return;
            }
             // Some type of file processing…
            System.err.println(“——————————————-”);
            System.err.println(“Test upload: ” + uploadItem.getFile().getOriginalFilename());
            System.err.println(“——————————————-”);
             //set extjs return – sucsess
            extjsFormResult.setSuccess(true);
            response.setContentType(‘text/html’) ;
            response.getWriter().write(extjsFormResult.toString());
            response.flushBuffer();
            return  ;
      }
    Thanks & Regards
    Shubhanshu Shukla
    Senior Software Engineer
    Lumata Group Landon.
    Last edited by skirtle; 6 Nov 2011 at 8:37 AM. Reason: Added CODE tags

  4. #4
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92
    Vote Rating
    0
    mkariti is on a distinguished road

      0  

    Default


    Hi mikkushukla,
    Many thanks for your quick reply.
    I actually dont use Spring framework.
    I use Sencha and .Net and I came to the same problem.
    Any I dea on how to solve this in my environment?
    Many thanks
    mkariti

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Posts
    3
    Vote Rating
    0
    mikkushukla is on a distinguished road

      0  

    Default Hi,

    Hi,


    Could you paste your server side code.

  6. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,489
    Answers
    526
    Vote Rating
    283
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    @mkariti. What are you returning from your server? I don't want to see the code, I just want to see the response as seen in Firebug, etc. What content-type header does the response have?

    Make sure you have read and understood this section of the docs and that your server is complying:

    http://docs.sencha.com/ext-js/4-0/#!...thod-hasUpload

  7. #7
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92
    Vote Rating
    0
    mkariti is on a distinguished road

      0  

    Default


    skirtle and mikkushukla many thanks for your reply.
    Really appreciate it!
    @mikkushukla - i will post it 2moro morning as I’m away of my computer.
    @skirtle - Thanks for the link. I had a look at it a few days ago.Also, I’ve tried all kind of Content types:

    context.Response.ContentType = "applicationj/json";
    context.Response.ContentType = "application/xml";
    context.Response.ContentType = "text/plain";
    context.Response.ContentType = "text/html";

    Also the response was accordingly. i.e. context.Response.Write("{'item':'A'}"); etc.
    For some reason I only accepted
    context.Response.ContentType = "applicationj/json";

    Also, in Sencha I got my string this way: "<pre>string</pre>"
    and only in FF not IE.
    Many thanks once again.

  8. #8
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,489
    Answers
    526
    Vote Rating
    283
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Please try to focus on the response itself rather than the code used to generate it. The code you use makes absolutely no difference to how the browser or ExtJS interpret the response, all that matters is the response itself.

    It may work in FF but that doesn't mean you can't use Firebug to capture the response and headers with a view to explaining the problem. It should be an identical response to the one in IE, after all.

    Also, in Sencha I got my string this way: "<pre>string</pre>"
    Not quite sure what you mean by this. A form upload response can be wrapped in an HTML textarea but wrapping it in pre tags will cause a parsing error when trying to decode the JSON.

    Could you let us know exactly which ExtJS version you're using and what code is on the line that throws the exception? It should be pretty easy using the IE debugger to track down information about the stacktrace too.

  9. #9
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92
    Vote Rating
    0
    mkariti is on a distinguished road

      0  

    Default


    Hi skirtle,
    Here is what Im getting from Httpfox:
    Code:
    (Request-Line)    POST /ServerData/uploadFilestotheServer.ashx HTTP/1.1
    Host    lmss.moshek
    User-Agent    Mozilla/5.0 (Windows NT 5.2; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
    Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language    en-gb,en;q=0.5
    Accept-Encoding    gzip, deflate
    Accept-Charset    ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Connection    keep-alive
    Referer    http://lmss.moshek/Pages/org_InstitutionCreate.aspx?id=455
    Cookie    ASP.NET_SessionId=pe4uv0552vyu0i45exmdsg55;  login=E2B59C91E2D6EB72C0399B838C833F1684773FE7C34BAEC4AFF443B171AF487EB842D63F95E3C2DA50CF7D2D11DC70C985D6C03508412E9780CC1F9E6A2BDFA4990ED8683497B7F24C663C5826932AA013C7CBCE92CF13CDCF5EF0B0BCE2156991E950064F4272FC37A8E7BB066DB54466B03C36
    Content-Type    multipart/form-data; boundary=---------------------------181274673728
    Content-Length    7089
    Also, Please see attached the images from firebug. one for form and one for action (Hope you can see the images).
    Here is where I get the error.Sorry minified form so no line number:
    Code:
    function(json,safe){if(!dc){dc=isNative()?JSON.parse:doDecode}try{return dc(json)}
    Many thanks
    mkariti
    Attached Images

  10. #10
    Sencha User mkariti's Avatar
    Join Date
    Aug 2011
    Posts
    92
    Vote Rating
    0
    mkariti is on a distinguished road

      0  

    Default


    Hi skirtle,
    I think I misused the hasUpload( ) function.
    Any chance you can post a sample on how to use it? I cant find one that will clearly explain this.
    IMany thanks
    mkariti

Thread Participants: 2