it has to be in the main form afaik François Le 7 déc. 2010 à 20:27, Cédric Thiébault a écrit :
> I've done this in the modal window form... And I set it to false for > the main form that is not used for uploading. > The upload works well, it's when my modal is closed, the main form > (not the one for the upload) throws an exception on submit. > > Here is the code that I've attached to the Jira issue: > http://dl.dropbox.com/u/2167784/wicket-modal-upload.zip > > Cedric > > > 2010/12/7 François Meillet <[email protected]>: >> 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: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
