Re: Upload file and display its contents using AJAX
Wicket uses an iframe internally for Ajax file uploads. On Wed, Dec 5, 2012 at 11:55 AM, pureza pur...@gmail.com wrote: I was able to get rid of the submit button, but I don't understand why it works (maybe some wicket magic?). I have a Form object and in the onSubmit() method I read the uploaded file and store it in a model. I also added an AjaxFormSubmitBehavior to the form that updates the textarea with the contents of the file via ajax. The markup is simply: This works fine (i.e. when I choose a file to upload the textarea is updated with the file's contents), but I don't understand why. The form submission does not refresh the whole page, but I was told that the only way I could do this was using an iframe, which I'm not doing. Please note that I am also not using any kind of upload library such as jquery-file-upload. Do you have any idea as to why this works the way it does? I'm clueless... Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473p4654508.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Upload file and display its contents using AJAX
Thanks Martin, I had just found https://issues.apache.org/jira/browse/WICKET-2420 before reading your reply! I guess that clears things. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473p4654510.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Upload file and display its contents using AJAX
Hi, I need to upload a file, parse it and display its contents inside a textarea, all this using ajax. At first I tried to use jquery-file-upload, and I was able to upload the file to an IResource as explained at http://wicketinaction.com/2012/11/uploading-files-to-wicket-iresource/. However, I have no idea as to how to display the contents of the file inside the textarea when the upload is finished. Then I tried to use a plain FileUploadField component and I attached an AjaxFormSubmitBehavior to it, but it seems that the model is always null and I am unable to access the uploaded files. Any help is appreciated. Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Upload file and display its contents using AJAX
Once the file is uploaded, set the contents of the IModel backing the TextArea, and then add the Form(or TextArea) to the AjaxRequestTarget. On Tue, Dec 4, 2012 at 11:51 AM, pureza pur...@gmail.com wrote: Hi, I need to upload a file, parse it and display its contents inside a textarea, all this using ajax. At first I tried to use jquery-file-upload, and I was able to upload the file to an IResource as explained at http://wicketinaction.com/2012/11/uploading-files-to-wicket-iresource/. However, I have no idea as to how to display the contents of the file inside the textarea when the upload is finished. Then I tried to use a plain FileUploadField component and I attached an AjaxFormSubmitBehavior to it, but it seems that the model is always null and I am unable to access the uploaded files. Any help is appreciated. Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Upload file and display its contents using AJAX
Nick, As I said on my previous email, I can't access the file contents within an AjaxBehavior, because FileInputField.getModelObject() is always null (maybe I'm not setting it up correctly when I instantiate the FileInputField?). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473p4654477.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Upload file and display its contents using AJAX
Hi again, I was able to get the desired result by putting an AjaxButton on the form containing the input type=file component. So, the user selects a file, presses submit and everything works. However, I'd prefer if the upload would start immediately after the user selects a file. Can I get rid of the button? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473p4654478.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Version 6.0.0-beta3: Ajax upload file is not working in IE
Hi, Please create a ticket with a quickstart. On Wed, Aug 8, 2012 at 9:05 AM, David JavaDeveloper javadeveloper.da...@gmail.com wrote: Hi, The description of the problem: In IE (IE8, IE9), when pressing on the button that supposed to do the Ajax upload – a new explorer window is opened with the ajax-response content. and the upload itself failed. Note that in Firefox Chrome it's working well. *You can see the problem in the wicket-examples of version 6.0.0-beta3*. (I took the wicket-examples from the wicket 6.0.0-beta3. download folder, and I created it as a java project. My purpose was to check if this is only my application problem or a real problem. And actually I saw that a similar problem exists also in the Ajax upload file of wicket-examples of version 6.0.0-beta3. ) I would like to hear if more people are familiar with the issue., and if you think that is a real problem. Thanks David -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Version 6.0.0-beta3: Ajax upload file is not working in IE
Ok, I did. https://issues.apache.org/jira/browse/WICKET-4701 On Wed, Aug 8, 2012 at 9:43 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, Please create a ticket with a quickstart. On Wed, Aug 8, 2012 at 9:05 AM, David JavaDeveloper javadeveloper.da...@gmail.com wrote: Hi, The description of the problem: In IE (IE8, IE9), when pressing on the button that supposed to do the Ajax upload – a new explorer window is opened with the ajax-response content. and the upload itself failed. Note that in Firefox Chrome it's working well. *You can see the problem in the wicket-examples of version 6.0.0-beta3*. (I took the wicket-examples from the wicket 6.0.0-beta3. download folder, and I created it as a java project. My purpose was to check if this is only my application problem or a real problem. And actually I saw that a similar problem exists also in the Ajax upload file of wicket-examples of version 6.0.0-beta3. ) I would like to hear if more people are familiar with the issue., and if you think that is a real problem. Thanks David -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
upload file content to textarea
In one of my wizard's steps I have a upload form and a textarea. The textarea is used to enter serial numbers(seperated by newline) and is connected to a object property of type SetString using a propertymodel. I've written a custom converter to turn the entered input to a SetString and from a SetString back to simple string. When pressing the wizard's next the input is validated and if valid the backing model will have SetString of serials. I want the upload form to be used to upload a file containing serial numbers. I would like that the content of the uploaded file will be placed into the textarea, so that when Next is pressed again it is validated. Is this possible? Can I put the file's content into the text area by pressing upload without ruining the property model the textarea uses?
Re: upload file content to textarea
You could ajax update the textarea after upload, with the content that you want? If you do not want to set the model object then you will have to fake raw input (reflection). ** Martin 2009/9/16 Sam Zilverberg samzilverb...@gmail.com: In one of my wizard's steps I have a upload form and a textarea. The textarea is used to enter serial numbers(seperated by newline) and is connected to a object property of type SetString using a propertymodel. I've written a custom converter to turn the entered input to a SetString and from a SetString back to simple string. When pressing the wizard's next the input is validated and if valid the backing model will have SetString of serials. I want the upload form to be used to upload a file containing serial numbers. I would like that the content of the uploaded file will be placed into the textarea, so that when Next is pressed again it is validated. Is this possible? Can I put the file's content into the text area by pressing upload without ruining the property model the textarea uses? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: upload file content to textarea
sounds good, but how do I do this? :) On Wed, Sep 16, 2009 at 9:45 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: You could ajax update the textarea after upload, with the content that you want? If you do not want to set the model object then you will have to fake raw input (reflection). ** Martin
Re: upload file content to textarea
1. You know how to upload file? http://www.wicket-library.com/wicket-examples/upload/single - or ajax upload http://blog.demay-fr.net/index.php/2007/12/07/93-simulate-ajax-file-upload-with-wicket 2. Just put the file contents into textarea with jafa reflection. 3. AJax update the textarea: http://www.wicket-library.com/wicket-examples/ajax/clock.2 - This is timed update..but similarly just add the textarea into ajax target. ** Martin 2009/9/16 Sam Zilverberg samzilverb...@gmail.com: sounds good, but how do I do this? :) On Wed, Sep 16, 2009 at 9:45 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: You could ajax update the textarea after upload, with the content that you want? If you do not want to set the model object then you will have to fake raw input (reflection). ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: upload file content to textarea
thanks a lot for the help and the links! I checked them all out, the second one (upload panel) was too complicated for me atm. Maybe I'l come back to it when I'l have more experience with wicket. I liked the timed ajax behaviour example, but couldn't figure out exactly how it works so i could use it in my project. ??how does the behaviour know how to update the clock?? I currently solved this problem by filtering the input from the uploaded file and creating a correct object model (SetString) out of it, then setting the modelObject of the textarea to be this filtered one. I also didn't understand what you meant by simply using reflection to put the content of the file into the textarea, did you mean simply using setModelObject( (SetString) uploadedContent) ? thanks again for all the help so far On Wed, Sep 16, 2009 at 11:32 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: 1. You know how to upload file? http://www.wicket-library.com/wicket-examples/upload/single - or ajax upload http://blog.demay-fr.net/index.php/2007/12/07/93-simulate-ajax-file-upload-with-wicket 2. Just put the file contents into textarea with jafa reflection. 3. AJax update the textarea: http://www.wicket-library.com/wicket-examples/ajax/clock.2 - This is timed update..but similarly just add the textarea into ajax target. ** Martin
Re: upload file content to textarea
Hi! I currently solved this problem by filtering the input from the uploaded file and creating a correct object model (SetString) out of it, then setting the modelObject of the textarea to be this filtered one. Good, so you got the upload part working. By reflection I mean that instead of setting model object you could do this, if necessary: public static T extends FormComponent? void fakeRawInput(T formComponent, T existingComponent) { try { String rawInput = (String) rawInputField.get(existingComponent); fakeRawInput(formComponent, rawInput); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } In this way your modelObject state does not change as compared to: simply using setModelObject( (SetString) uploadedContent) ? But if you can change the model that's definitely cleaner. ** Martin On Wed, Sep 16, 2009 at 11:32 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: 1. You know how to upload file? http://www.wicket-library.com/wicket-examples/upload/single - or ajax upload http://blog.demay-fr.net/index.php/2007/12/07/93-simulate-ajax-file-upload-with-wicket 2. Just put the file contents into textarea with jafa reflection. 3. AJax update the textarea: http://www.wicket-library.com/wicket-examples/ajax/clock.2 - This is timed update..but similarly just add the textarea into ajax target. ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: upload file content to textarea
Ah.. forgot that crucial part, the reflection: public static T extends FormComponent? void fakeRawInput(T formComponent, String value) { try { rawInputField.set(formComponent, value); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } where rawInputField = FormComponent.class.getDeclaredField(rawInput); rawInputField.setAccessible(true); 2009/9/17 Martin Makundi martin.maku...@koodaripalvelut.com: Hi! I currently solved this problem by filtering the input from the uploaded file and creating a correct object model (SetString) out of it, then setting the modelObject of the textarea to be this filtered one. Good, so you got the upload part working. By reflection I mean that instead of setting model object you could do this, if necessary: public static T extends FormComponent? void fakeRawInput(T formComponent, T existingComponent) { try { String rawInput = (String) rawInputField.get(existingComponent); fakeRawInput(formComponent, rawInput); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } In this way your modelObject state does not change as compared to: simply using setModelObject( (SetString) uploadedContent) ? But if you can change the model that's definitely cleaner. ** Martin On Wed, Sep 16, 2009 at 11:32 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: 1. You know how to upload file? http://www.wicket-library.com/wicket-examples/upload/single - or ajax upload http://blog.demay-fr.net/index.php/2007/12/07/93-simulate-ajax-file-upload-with-wicket 2. Just put the file contents into textarea with jafa reflection. 3. AJax update the textarea: http://www.wicket-library.com/wicket-examples/ajax/clock.2 - This is timed update..but similarly just add the textarea into ajax target. ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: upload file content to textarea
I'd rather use some other method than mine, because with mine the validation of input is done twice when uploading. first on the uploaded file, and then another time on the textarea when pressing the wizard's next button. I tried replacing my fixup with this one but got a big fat java.lang.NoSuchFieldException on getDeclaredField( name) line in the code. I got this a couple of times using different names such as TextArea.class.getSimpleName() and serials (the wicket id for the textarea). Any ideas on what name I should be using? heres some code and the markup for the wizard page with the upload form/textarea : wicket:panel table tr td form wicket:id=simpleUpload fieldset label for=uploadFile/label input wicket:id=fileInput id=upload type=file / button wicket:id=uploadButton span wicket:id=uploadLabelupload/span/button /fieldset /form /td td wicket:message key=serials.textareaInfoinfo message/wicket:message br/ textarea wicket:id=serials/textarea /td /tr /table i'm using button wicket:id=uploadButton in the markup instead of input type=submit as per the example because pressing the latter button causes the whole wizard page to validate, including the text area which is usualy empty in the case of file upload. Button uploadButton = new Button(uploadButton) { @Override public void onSubmit() { final FileUpload upload = fileUploadField.getFileUpload(); if (upload != null) { String uploadedContent = new String(upload.getBytes()); try { Field f = FormComponent.class.getDeclaredField(TextArea.class.getSimpleName()); f.setAccessible(true); f.set(textArea, uploadedContent); } catch (Exception e) { e.printStackTrace(); } } } } On Thu, Sep 17, 2009 at 12:29 AM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Ah.. forgot that crucial part, the reflection: public static T extends FormComponent? void fakeRawInput(T formComponent, String value) { try { rawInputField.set(formComponent, value); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } where rawInputField = FormComponent.class.getDeclaredField(rawInput); rawInputField.setAccessible(true); 2009/9/17 Martin Makundi martin.maku...@koodaripalvelut.com: Hi! I currently solved this problem by filtering the input from the uploaded file and creating a correct object model (SetString) out of it, then setting the modelObject of the textarea to be this filtered one. Good, so you got the upload part working. By reflection I mean that instead of setting model object you could do this, if necessary: public static T extends FormComponent? void fakeRawInput(T formComponent, T existingComponent) { try { String rawInput = (String) rawInputField.get(existingComponent); fakeRawInput(formComponent, rawInput); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } In this way your modelObject state does not change as compared to: simply using setModelObject( (SetString) uploadedContent) ? But if you can change the model that's definitely cleaner. ** Martin
Re: upload file content to textarea
No.. the field name is rawInput: rawInputField = FormComponent.class.getDeclaredField(rawInput); ** Martin 2009/9/17 Sam Zilverberg samzilverb...@gmail.com: I'd rather use some other method than mine, because with mine the validation of input is done twice when uploading. first on the uploaded file, and then another time on the textarea when pressing the wizard's next button. I tried replacing my fixup with this one but got a big fat java.lang.NoSuchFieldException on getDeclaredField( name) line in the code. I got this a couple of times using different names such as TextArea.class.getSimpleName() and serials (the wicket id for the textarea). Any ideas on what name I should be using? heres some code and the markup for the wizard page with the upload form/textarea : wicket:panel table tr td form wicket:id=simpleUpload fieldset label for=uploadFile/label input wicket:id=fileInput id=upload type=file / button wicket:id=uploadButton span wicket:id=uploadLabelupload/span/button /fieldset /form /td td wicket:message key=serials.textareaInfoinfo message/wicket:message br/ textarea wicket:id=serials/textarea /td /tr /table i'm using button wicket:id=uploadButton in the markup instead of input type=submit as per the example because pressing the latter button causes the whole wizard page to validate, including the text area which is usualy empty in the case of file upload. Button uploadButton = new Button(uploadButton) { �...@override public void onSubmit() { final FileUpload upload = fileUploadField.getFileUpload(); if (upload != null) { String uploadedContent = new String(upload.getBytes()); try { Field f = FormComponent.class.getDeclaredField(TextArea.class.getSimpleName()); f.setAccessible(true); f.set(textArea, uploadedContent); } catch (Exception e) { e.printStackTrace(); } } } } On Thu, Sep 17, 2009 at 12:29 AM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: Ah.. forgot that crucial part, the reflection: public static T extends FormComponent? void fakeRawInput(T formComponent, String value) { try { rawInputField.set(formComponent, value); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } where rawInputField = FormComponent.class.getDeclaredField(rawInput); rawInputField.setAccessible(true); 2009/9/17 Martin Makundi martin.maku...@koodaripalvelut.com: Hi! I currently solved this problem by filtering the input from the uploaded file and creating a correct object model (SetString) out of it, then setting the modelObject of the textarea to be this filtered one. Good, so you got the upload part working. By reflection I mean that instead of setting model object you could do this, if necessary: public static T extends FormComponent? void fakeRawInput(T formComponent, T existingComponent) { try { String rawInput = (String) rawInputField.get(existingComponent); fakeRawInput(formComponent, rawInput); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access failed., e); } } In this way your modelObject state does not change as compared to: simply using setModelObject( (SetString) uploadedContent) ? But if you can change the model that's definitely cleaner. ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: After Upload File via ModalWindow and IFrame, the TreeModels UserOject Attributes are null
I don't think it's because of the iFrame. If you take it out of the modal page content, will that stop messing up the linktree? can you provide more code? On Mon, Apr 28, 2008 at 2:15 PM, geke [EMAIL PROTECTED] wrote: Hello, I´m upload a file via a modal window and an iFrame. It`s described in http://www.dooriented.com/blog/2008/04/23/wicket-ajax-like-file-upload-on-a-modal-window . Also I have a LinkTree on my site. But after closing the modal window, the tree models userObject has a reference, but the attributes of the userObject are all null. Hence after the onClicked event on nodes in my tree, there are no Nodes visible. That is even the modal window is closed without a fileupload. It seems to me, that there is a problem with the iFrame. I´m thankfully for any inspiration -- View this message in context: http://www.nabble.com/After-Upload-File-via-ModalWindow-and-IFrame%2C-the-TreeModels-UserOject-Attributes-are-null-tp16936673p16936673.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: After Upload File via ModalWindow and IFrame, the TreeModels UserOject Attributes are null
I have attached my source Files. There are a few files, I hope it don`t slay to you;-) If I take out the iFrame from the modal window everything works fine. Hope anyone can help me. Cristi Manole wrote: I don't think it's because of the iFrame. If you take it out of the modal page content, will that stop messing up the linktree? can you provide more code? On Mon, Apr 28, 2008 at 2:15 PM, geke [EMAIL PROTECTED] wrote: Hello, I´m upload a file via a modal window and an iFrame. It`s described in http://www.dooriented.com/blog/2008/04/23/wicket-ajax-like-file-upload-on-a-modal-window . Also I have a LinkTree on my site. But after closing the modal window, the tree models userObject has a reference, but the attributes of the userObject are all null. Hence after the onClicked event on nodes in my tree, there are no Nodes visible. That is even the modal window is closed without a fileupload. It seems to me, that there is a problem with the iFrame. I´m thankfully for any inspiration -- View this message in context: http://www.nabble.com/After-Upload-File-via-ModalWindow-and-IFrame%2C-the-TreeModels-UserOject-Attributes-are-null-tp16936673p16936673.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://www.nabble.com/file/p16977821/Tree_Modal_FileUpload.zip Tree_Modal_FileUpload.zip -- View this message in context: http://www.nabble.com/After-Upload-File-via-ModalWindow-and-IFrame%2C-the-TreeModels-UserOject-Attributes-are-null-tp16936673p16977821.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Upload file
ExternalLink works great with relative path (/DownloadedFiles/file1) and I was able to access the context path using getServletContext().getRealPath(/) in Application.init Thanks Pierre Nino.Martinez wrote: folder.getFiles()[1].toURL() should give the direct url for the file, now if you want to serve if through wicket then you got to use resources.. Otherwise just create some externalLinks and that should be it.. -- View this message in context: http://www.nabble.com/Upload-file-tp15849850p15868265.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Upload file
great:) and np.. Pierre G wrote: ExternalLink works great with relative path (/DownloadedFiles/file1) and I was able to access the context path using getServletContext().getRealPath(/) in Application.init Thanks Pierre Nino.Martinez wrote: folder.getFiles()[1].toURL() should give the direct url for the file, now if you want to serve if through wicket then you got to use resources.. Otherwise just create some externalLinks and that should be it.. -- -Wicket for love -Jme for fun Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Upload file
I try to modify the upload example (http://www.wicket-library.com/wicket-examples/upload/single) for my own need. I would like to be able to upload the file in a directory under my context (ie. tomcat_install/webapps/MyApp/DownloadedFiles) and generate the corresponding internet url for the files (ie. http://localhost:8080/MyApp/DownloadedFiles/file1) How can I get the local and internet paths from my appli. ? Thanks in advance Pierre
Re: Upload file
Theres file in utils package.. Producing a url for that could be mounting a resource and using the urlfor... Pierre Gilquin wrote: I try to modify the upload example (http://www.wicket-library.com/wicket-examples/upload/single) for my own need. I would like to be able to upload the file in a directory under my context (ie. tomcat_install/webapps/MyApp/DownloadedFiles) and generate the corresponding internet url for the files (ie. http://localhost:8080/MyApp/DownloadedFiles/file1) How can I get the local and internet paths from my appli. ? Thanks in advance Pierre -- -Wicket for love -Jme for fun Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Upload file
Thanks Nino, Sorry, I dont understand. Please be more detailed. I try to use Folder from util.file package uploadFolder = new Folder(?, DownloadedFiles); then can I use the folder as resource ? how ? I still dont have any idea how to have my uploadFolder in the context Nino.Martinez wrote: Theres file in utils package.. Producing a url for that could be mounting a resource and using the urlfor... Pierre Gilquin wrote: I try to modify the upload example (http://www.wicket-library.com/wicket-examples/upload/single) for my own need. I would like to be able to upload the file in a directory under my context (ie. tomcat_install/webapps/MyApp/DownloadedFiles) and generate the corresponding internet url for the files (ie. http://localhost:8080/MyApp/DownloadedFiles/file1) How can I get the local and internet paths from my appli. ? Thanks in advance Pierre -- -Wicket for love -Jme for fun Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Upload-file-tp15849850p15852279.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unable to Upload file using AjaxFormSubmitBehavior
Hi Everyone I'm trying to upload a file using AjaxFormSubmitBehavior . When i submit the form , the defined onSubmit() method is not being called. Can anyone tell me why this is happening ? Code given below: Java code is : Form f = new Form(f); f.setOutputMarkupId(true); f.setMultiPart(true); f.setMaxSize(Bytes.MAX); f.add(upload = new FileUploadField(fileInput)); f.add(new Button(ok)); f.add(new AjaxFormSubmitBehavior(onsubmit) { protected void onSubmit(AjaxRequestTarget target) { log.debug(inside onSubmit); FileUpload fileUpload = upload.getFileUpload(); log.debug(fileUpload.getBytes()); } @Override protected void onError(AjaxRequestTarget arg0) { // TODO Auto-generated method stub } }); add(f); } Form in the html file is : form id=uploadForm wicket:id=f fieldset div input type=file wicket:id=fileInput/ input wicket:id=ok type=submit value=Upload!/ /div /fieldset /form Thanks Haritha Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
Re: Unable to Upload file using AjaxFormSubmitBehavior
file uploads using ajax are not supported -igor On Jan 10, 2008 4:59 PM, Haritha Juturu [EMAIL PROTECTED] wrote: Hi Everyone I'm trying to upload a file using AjaxFormSubmitBehavior . When i submit the form , the defined onSubmit() method is not being called. Can anyone tell me why this is happening ? Code given below: Java code is : Form f = new Form(f); f.setOutputMarkupId(true); f.setMultiPart(true); f.setMaxSize(Bytes.MAX); f.add(upload = new FileUploadField(fileInput)); f.add(new Button(ok)); f.add(new AjaxFormSubmitBehavior(onsubmit) { protected void onSubmit(AjaxRequestTarget target) { log.debug(inside onSubmit); FileUpload fileUpload = upload.getFileUpload(); log.debug(fileUpload.getBytes()); } @Override protected void onError(AjaxRequestTarget arg0) { // TODO Auto-generated method stub } }); add(f); } Form in the html file is : form id=uploadForm wicket:id=f fieldset div input type=file wicket:id=fileInput/ input wicket:id=ok type=submit value=Upload!/ /div /fieldset /form Thanks Haritha Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unable to Upload file using AjaxFormSubmitBehavior
I believe its because your submit button is getting hooked up with the Button(ok) instead and not the AjaxForm-Submit..i wouldnt define the Button on the page-component and similarly would remove wicket:id = ok from the tag.. Haritha Juturu wrote: Hi Everyone I'm trying to upload a file using AjaxFormSubmitBehavior . When i submit the form , the defined onSubmit() method is not being called. Can anyone tell me why this is happening ? Code given below: Java code is : Form f = new Form(f); f.setOutputMarkupId(true); f.setMultiPart(true); f.setMaxSize(Bytes.MAX); f.add(upload = new FileUploadField(fileInput)); f.add(new Button(ok)); f.add(new AjaxFormSubmitBehavior(onsubmit) { protected void onSubmit(AjaxRequestTarget target) { log.debug(inside onSubmit); FileUpload fileUpload = upload.getFileUpload(); log.debug(fileUpload.getBytes()); } @Override protected void onError(AjaxRequestTarget arg0) { // TODO Auto-generated method stub } }); add(f); } Form in the html file is : form id=uploadForm wicket:id=f fieldset div input type=file wicket:id=fileInput/ input wicket:id=ok type=submit value=Upload!/ /div /fieldset /form Thanks Haritha Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- View this message in context: http://www.nabble.com/Unable-to-Upload-file-using-AjaxFormSubmitBehavior-tp14747634p14747752.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]