just add 
form.setMultiPart(true);

in your form

François

Le 7 déc. 2010 à 20:11, Cédric Thiébault a écrit :

> Hi,
> 
> I want to upload files with an Ajax form that is in a modal window
> (using a Panel, not a WebPage). The modal and its form are part of the
> main form:
> 
> main-page.html
> <form wicket:id="form">
>  <div wicket:id="modal" />
>  <input type="submit" wicket:id="submit" />
> </form>
> 
> upload-window.html
> <form wicket:id="form">
>  <input type="file" wicket:id="file" />
>  <input type="submit" wicket:id="submit" />
> </form>
> 
> 
> I'm able to upload a file but once the modal is closed, when I submit
> the main form (not the one for uploading), I get an exception:
> 
> java.lang.IllegalStateException: ServletRequest does not contain
> multipart content. One possible solution is to explicitly call
> Form.setMultipart(true), Wicket tries its best to auto-detect
> multipart forms but there are certain situation where it cannot.
>     at 
> org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest.<init>(MultipartServletWebRequest.java:113)
>     at 
> org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest.<init>(MultipartServletWebRequest.java:83)
>     at 
> org.apache.wicket.protocol.http.servlet.ServletWebRequest.newMultipartWebRequest(ServletWebRequest.java:489)
>     at org.apache.wicket.markup.html.form.Form.handleMultiPart(Form.java:1708)
>     at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:886)
>     at 
> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:135)
>     at 
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:177)
>     at 
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:300)
>     at 
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:142)
>     at 
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>     at 
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
>     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
>     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
>     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
>     at 
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
>     at 
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
> 
> 
> I've created a JIRA issue with code example
> (https://issues.apache.org/jira/browse/WICKET-3236) but maybe I
> misunderstood something here...
> Any help would be appreciated ;-)
> 
> Thanks
> 
> Cedric
> 
> ---------------------------------------------------------------------
> 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

Reply via email to