You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Fabien D." <du...@hotmail.com> on 2008/04/02 10:29:03 UTC
Problems and Questions about MultiFileUploadField,
UploadProgressBar
Hi,
First, I have a question : is it possible to use MultiFileUploadField,
UploadProgressBar together?or UploadProgressBar is only for simpleUpload?
Secondly, I have a problem to use MultiFileUploadField (I adapt the example
http://wicketstuff.org/wicket13/upload/multi). For the moment, I can add
files into the ListView of uploaded files. But I have I exception when i try
to upload (so go to onSubmit)...
This is my code of my form:
*******************************************************
this.form_importerarticle = new Form("form_importerarticle") {
protected void onSubmit() {
Iterator it = list_file.iterator();
while (it.hasNext())
{
final FileUpload upload = (FileUpload)it.next();
// Create a new file
File newFile = new File(getUploadFolder(),
upload.getClientFileName());
// Check new file, delete if it allready existed
checkFileExists(newFile);
try
{
log.info("test5");
// Save to new file
newFile.createNewFile();
upload.writeTo(newFile);
}
catch (Exception e)
{
throw new IllegalStateException("Unable to write
file");
}
}
}
};
this.form_importerarticle.setMultiPart(true);
this.form_importerarticle.add(new MultiFileUploadField("fileInput", 10));
this.form_importerarticle.setMaxSize(Bytes.megabytes(30));
*******************************************************
I populated my ListView like this :
this.listview_file = new ListView("listview_file", list_file) {
protected void populateItem(ListItem listItem)
{
final File file = (File)listItem.getModelObject();
listItem.add(new Label("file", file.getName()));
listItem.add(new Link("delete_file")
{
public void onClick()
{
Files.remove(file);
//this.uploadFeedback.info("Suppression du fichier "
+ file);
}
});
}
};
this.form_importerarticle.add(listview_file);
this.form_importerarticle.add(this.uploadFeedback);
I have also added this in my WebApplication class of my projet (to allow
upload???)
protected WebRequest newWebRequest(HttpServletRequest servletRequest)
{
return new UploadWebRequest(servletRequest);
}
Finally this is my exception :
*********************************************************
ERROR [http-8080-1] (RequestCycle.java:1413) - Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component [MarkupContainer [Component id = form_importerarticle, page =
com.mycompany.projet.ProjetPage, path =
7:panelprojet:form_importerarticle.PanelAjInfCommunautaire$1, isVisible =
true, isVersioned = true]] threw an exception
org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component [MarkupContainer [Component id = form_importerarticle, page =
com.mycompany.projet.ProjetPage, path =
7:panelprojet:form_importerarticle.PanelAjInfCommunautaire$1, isVisible =
true, isVersioned = true]] threw an exception
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194)
at
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1166)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
When I try to upload, it doesn't enter into the method onSubmit of the form,
so I think I miss something....
TRhank you for your help :) :)
--
View this message in context: http://www.nabble.com/Problems-and-Questions-about-MultiFileUploadField%2C-UploadProgressBar-tp16445359p16445359.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems and Questions about MultiFileUploadField,
UploadProgressBar
Posted by "Fabien D." <du...@hotmail.com>.
Yes, it was just a problem of Model to get back data
this.form_importerarticle = new Form("form_importerarticle") {
protected void onSubmit() {
List list = (List)model_upload.getObject();
Iterator it = list.iterator();
.........
}};
this.form_importerarticle.add(new MultiFileUploadField("fileInput",
this.model_upload, 10));
Moreover, I don't think that is possible to use MultiFileUploadField,
UploadProgressBar together, because UploadProgressBar is linked with the
simple Upload field.
Peter Ertl wrote:
>
> Great!
>
> So could you share your experience?
>
>
> Am 02.04.2008 um 11:58 schrieb Fabien D.:
>
>>
>> My problem is fixed! :)
>>
>> I search response for my question : is it possible to use
>> MultiFileUploadField, UploadProgressBar together?or
>> UploadProgressBar is
>> only for simpleUpload?
>> --
>> View this message in context:
>> http://www.nabble.com/Problems-and-Questions-about-MultiFileUploadField%2C-UploadProgressBar-tp16445359p16446351.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Problems-and-Questions-about-MultiFileUploadField%2C-UploadProgressBar-tp16445359p16467263.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems and Questions about MultiFileUploadField, UploadProgressBar
Posted by Peter Ertl <pe...@gmx.net>.
Great!
So could you share your experience?
Am 02.04.2008 um 11:58 schrieb Fabien D.:
>
> My problem is fixed! :)
>
> I search response for my question : is it possible to use
> MultiFileUploadField, UploadProgressBar together?or
> UploadProgressBar is
> only for simpleUpload?
> --
> View this message in context: http://www.nabble.com/Problems-and-Questions-about-MultiFileUploadField%2C-UploadProgressBar-tp16445359p16446351.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems and Questions about MultiFileUploadField,
UploadProgressBar
Posted by "Fabien D." <du...@hotmail.com>.
My problem is fixed! :)
I search response for my question : is it possible to use
MultiFileUploadField, UploadProgressBar together?or UploadProgressBar is
only for simpleUpload?
--
View this message in context: http://www.nabble.com/Problems-and-Questions-about-MultiFileUploadField%2C-UploadProgressBar-tp16445359p16446351.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org