Re: Problems with FileUploadFile and CompoundPropertyModels
sounds good ! François Meillet Formation Wicket - Développement Wicket Le 25 oct. 2013 à 20:13, Edgar Merino a écrit : > Thank you Francois, but as I mentioned in an earlier post overriding > FileUploadField#initModel() to return null did the trick and seems a bit > cleaner that creating a Dummy model. Overriding initModel() makes sure the > model won't be looked up in the component parents. > > > Edgar Merino > > On 25/10/13 13:03, Francois Meillet wrote: >> FileUploadField needs a model which implements IModel> >> >> have a look to these threads >> >> http://apache-wicket.1842946.n4.nabble.com/file-upload-in-nested-form-with-CPM-needs-dummy-model-td4660468.html >> http://apache-wicket.1842946.n4.nabble.com/AW-file-upload-in-nested-form-with-CPM-needs-dummy-model-td4660609.html >> >> >> François Meillet >> Formation Wicket - Développement Wicket >> >> >> >> >> >> Le 25 oct. 2013 à 19:30, Edgar Merino a écrit : >> >>> Hello, I'm having a problem with a FileUploadField, I'm using >>> CompoundPropertyModels through my application but for this single element I >>> would like to avoid having a model, however calling >>> fileUploadField.setDefauiltModel(null) will not work, since it will always >>> try to locate a CompoundPropertyModel, is there a way to avoid this? >>> >>> Thanks in advance. >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
Re: Problems with FileUploadFile and CompoundPropertyModels
Thank you Francois, but as I mentioned in an earlier post overriding FileUploadField#initModel() to return null did the trick and seems a bit cleaner that creating a Dummy model. Overriding initModel() makes sure the model won't be looked up in the component parents. Edgar Merino On 25/10/13 13:03, Francois Meillet wrote: FileUploadField needs a model which implements IModel> have a look to these threads http://apache-wicket.1842946.n4.nabble.com/file-upload-in-nested-form-with-CPM-needs-dummy-model-td4660468.html http://apache-wicket.1842946.n4.nabble.com/AW-file-upload-in-nested-form-with-CPM-needs-dummy-model-td4660609.html François Meillet Formation Wicket - Développement Wicket Le 25 oct. 2013 à 19:30, Edgar Merino a écrit : Hello, I'm having a problem with a FileUploadField, I'm using CompoundPropertyModels through my application but for this single element I would like to avoid having a model, however calling fileUploadField.setDefauiltModel(null) will not work, since it will always try to locate a CompoundPropertyModel, is there a way to avoid this? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems with FileUploadFile and CompoundPropertyModels
FileUploadField needs a model which implements IModel> have a look to these threads http://apache-wicket.1842946.n4.nabble.com/file-upload-in-nested-form-with-CPM-needs-dummy-model-td4660468.html http://apache-wicket.1842946.n4.nabble.com/AW-file-upload-in-nested-form-with-CPM-needs-dummy-model-td4660609.html François Meillet Formation Wicket - Développement Wicket Le 25 oct. 2013 à 19:30, Edgar Merino a écrit : > Hello, I'm having a problem with a FileUploadField, I'm using > CompoundPropertyModels through my application but for this single element I > would like to avoid having a model, however calling > fileUploadField.setDefauiltModel(null) will not work, since it will always > try to locate a CompoundPropertyModel, is there a way to avoid this? > > Thanks in advance. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
RE: Problems with FileUploadFile and CompoundPropertyModels
Take a look over Section 11.7 "File upload" of the Wicket Guide: http://wicket.apache.org/guide/guide/chapter11.html#chapter11_7 You need something like this: fileUploadField = new FileUploadField("fileUploadField"); Form form = new Form("form"){ @Override protected void onSubmit() { super.onSubmit(); FileUpload fileUpload = fileUploadField.getFileUpload(); try { File file = new File(System.getProperty("java.io.tmpdir") + "/" + fileUpload.getClientFileName()); fileUpload.writeTo(file); } catch (IOException e) { e.printStackTrace(); } } }; ~ Thank you, Paul Bors -Original Message- From: Edgar Merino [mailto:donvo...@gmail.com] Sent: Friday, October 25, 2013 1:30 PM To: users@wicket.apache.org Subject: Problems with FileUploadFile and CompoundPropertyModels Hello, I'm having a problem with a FileUploadField, I'm using CompoundPropertyModels through my application but for this single element I would like to avoid having a model, however calling fileUploadField.setDefauiltModel(null) will not work, since it will always try to locate a CompoundPropertyModel, is there a way to avoid this? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Problems with FileUploadFile and CompoundPropertyModels
It seems that overriding Component#initModel() to return null does the trick! On 25/10/13 12:30, Edgar Merino wrote: Hello, I'm having a problem with a FileUploadField, I'm using CompoundPropertyModels through my application but for this single element I would like to avoid having a model, however calling fileUploadField.setDefauiltModel(null) will not work, since it will always try to locate a CompoundPropertyModel, is there a way to avoid this? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org