You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ian Marshall <Ia...@GMail.com> on 2011/10/07 11:39:23 UTC

Converter for FileUpload

Hello All,

I am porting my Wicket 1.4.18 application to 1.5.1.

I am now getting the following exception when I use a
org.apache.wicket.markup.html.form.upload.FileUploadField to upload a file,
when all worked well in 1.4.18:

  ... 43 more
Caused by: org.apache.wicket.util.convert.ConversionException: Could not
convert value:
[org.apache.wicket.markup.html.form.upload.FileUpload@1b3d1e5] to type:
org.apache.wicket.markup.html.form.upload.FileUpload. Could not find
compatible converter.
  at
org.apache.wicket.ConverterLocator$DefaultConverter.convertToObject(ConverterLocator.java:109)
  ... 63 more

Does anyone know of an org.apache.wicket.util.convert.IConverter<?> for
org.apache.wicket.markup.html.form.upload.FileUpload, or will I have to roll
my own?

My development environment is:
  ∙  Web framework: Apache Wicket 1.5.1 using libraries (I am an Ant user):
     ∙  wicket-core-1.5.1.jar
     ∙  wicket-request-1.5.1.jar
     ∙  wicket-util-1.5.1.jar
  ∙  Web server environment: Google App Engine
  ∙  Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
  ∙  System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
  ∙  IDE: NetBeans 7.0.1 (Build 201107282000)
  ∙  Web browser: Mozilla Firefox 7.0.1


Regards,

Ian Marshall

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Converter-for-FileUpload-tp3881522p3881522.html
Sent from the Users forum 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: Converter for FileUpload

Posted by Ian Marshall <Ia...@GMail.com>.
Fantastic, Martin!

I have changed the model for my FileUploadField from FileUpload to
List<FileUpload> and all works fine, without me having to roll my own
converter. (I didn't spot that the constructor for FieldUploadField which
takes a model now takes a model of type IModel&lt;List&lt;FileUpload&gt;>.)

Thanks very much, and have a good weekend,

Ian



Martin Grigorov-4 wrote:
> 
> The difference in FileUploadField from 1.4.x to 1.5.x is that now it
> supports <input type="file" multiple/> (HTML5 standards) and it works
> with List<FileUpload> instead of just FileUpload.
> You need to update your getConverter() impl to expect List<FileUpload>
> 
> On Fri, Oct 7, 2011 at 12:39 PM, Ian Marshall &lt;IanMarshall.UK@&gt;
> wrote:
>> Hello All,
>>
>> I am porting my Wicket 1.4.18 application to 1.5.1.
>>
>> I am now getting the following exception when I use a
>> org.apache.wicket.markup.html.form.upload.FileUploadField to upload a
>> file,
>> when all worked well in 1.4.18:
>>
>>  ... 43 more
>> Caused by: org.apache.wicket.util.convert.ConversionException: Could not
>> convert value:
>> [org.apache.wicket.markup.html.form.upload.FileUpload@1b3d1e5] to type:
>> org.apache.wicket.markup.html.form.upload.FileUpload. Could not find
>> compatible converter.
>>  at
>> org.apache.wicket.ConverterLocator$DefaultConverter.convertToObject(ConverterLocator.java:109)
>>  ... 63 more
>>
>> Does anyone know of an org.apache.wicket.util.convert.IConverter<?> for
>> org.apache.wicket.markup.html.form.upload.FileUpload, or will I have to
>> roll
>> my own?
>>
>> My development environment is:
>>  ∙  Web framework: Apache Wicket 1.5.1 using libraries (I am an Ant
>> user):
>>     ∙  wicket-core-1.5.1.jar
>>     ∙  wicket-request-1.5.1.jar
>>     ∙  wicket-util-1.5.1.jar
>>  ∙  Web server environment: Google App Engine
>>  ∙  Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
>>  ∙  System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
>>  ∙  IDE: NetBeans 7.0.1 (Build 201107282000)
>>  ∙  Web browser: Mozilla Firefox 7.0.1
>>
>>
>> Regards,
>>
>> Ian Marshall
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Converter-for-FileUpload-tp3881522p3881522.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@.apache
>> For additional commands, e-mail: users-help@.apache
>>
>>
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@.apache
> For additional commands, e-mail: users-help@.apache
> 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Converter-for-FileUpload-tp3881522p3882908.html
Sent from the Users forum 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: Converter for FileUpload

Posted by Martin Grigorov <mg...@apache.org>.
The difference in FileUploadField from 1.4.x to 1.5.x is that now it
supports <input type="file" multiple/> (HTML5 standards) and it works
with List<FileUpload> instead of just FileUpload.
You need to update your getConverter() impl to expect List<FileUpload>

On Fri, Oct 7, 2011 at 12:39 PM, Ian Marshall <Ia...@gmail.com> wrote:
> Hello All,
>
> I am porting my Wicket 1.4.18 application to 1.5.1.
>
> I am now getting the following exception when I use a
> org.apache.wicket.markup.html.form.upload.FileUploadField to upload a file,
> when all worked well in 1.4.18:
>
>  ... 43 more
> Caused by: org.apache.wicket.util.convert.ConversionException: Could not
> convert value:
> [org.apache.wicket.markup.html.form.upload.FileUpload@1b3d1e5] to type:
> org.apache.wicket.markup.html.form.upload.FileUpload. Could not find
> compatible converter.
>  at
> org.apache.wicket.ConverterLocator$DefaultConverter.convertToObject(ConverterLocator.java:109)
>  ... 63 more
>
> Does anyone know of an org.apache.wicket.util.convert.IConverter<?> for
> org.apache.wicket.markup.html.form.upload.FileUpload, or will I have to roll
> my own?
>
> My development environment is:
>  ∙  Web framework: Apache Wicket 1.5.1 using libraries (I am an Ant user):
>     ∙  wicket-core-1.5.1.jar
>     ∙  wicket-request-1.5.1.jar
>     ∙  wicket-util-1.5.1.jar
>  ∙  Web server environment: Google App Engine
>  ∙  Java: 1.6.0_27; Java HotSpot(TM) Client VM 20.2-b06
>  ∙  System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)
>  ∙  IDE: NetBeans 7.0.1 (Build 201107282000)
>  ∙  Web browser: Mozilla Firefox 7.0.1
>
>
> Regards,
>
> Ian Marshall
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Converter-for-FileUpload-tp3881522p3881522.html
> Sent from the Users forum 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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org