-
26 Sep 2011 10:48 PM #1
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.
-
6 Nov 2011 6:25 AM #2
mikkushukla,
Can you please let me know how did you fix this?
Im running to the same problem.
Cheers
mkariti
-
6 Nov 2011 6:35 AM #3
Here is the solutions.
Here is the solutions.
Just avoid using this kind of approach in spring controller...
Correct Way for writing file upload controller isCode:@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(); }
Thanks & RegardsCode: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 ; }
Shubhanshu Shukla
Senior Software Engineer
Lumata Group Landon.Last edited by skirtle; 6 Nov 2011 at 8:37 AM. Reason: Added CODE tags
-
6 Nov 2011 6:46 AM #4
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
-
6 Nov 2011 8:01 AM #5
Hi,
Hi,
Could you paste your server side code.
-
6 Nov 2011 8:48 AM #6
@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
-
6 Nov 2011 9:38 AM #7
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.
-
6 Nov 2011 10:10 AM #8
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.
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.Also, in Sencha I got my string this way: "<pre>string</pre>"
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.
-
6 Nov 2011 10:53 PM #9
Hi skirtle,
Here is what Im getting from Httpfox:
Also, Please see attached the images from firebug. one for form and one for action (Hope you can see the images).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
Here is where I get the error.Sorry minified form so no line number:
Many thanksCode:function(json,safe){if(!dc){dc=isNative()?JSON.parse:doDecode}try{return dc(json)}
mkariti
-
6 Nov 2011 11:35 PM #10
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


Reply With Quote