2012-10-27 38 views
2

我在wicket中写了一个面板,让我上传一个文件,它完全可以工作。
但是当我把在其他形式(wicket:id="outerForm")该面板,并上传文件时,它抛出从(component id= outerForm)异常:
在使用FileUpload时嵌套窗体上的检票窗问题

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.

outerform我已经打电话form.setMultipart(true)

没有人知道如何解决它?
我使用1.4.21检票

感谢

+0

你不试图通过AJAX提交外部表单吗?另外检查你是否真的使用POST方法提交外部表单。 –

+1

是的,我通过AJAX提交外部表单。问题已解决。是我的错。还有一个外部形式。它工作正常。你需要为所有表单编写'form.setMultipart(true)'。 –

回答

-1

您必须更改加密类型,因为你有上传文件的工作,所以才这样做:

在您的形式插入“setMultipart() ”。

例如:

public class MyForm extends Form<T>{ 

    public MyForm(String id){ 
    super(id); 
    setMultiPart(true); 
    } 

} 

我认为它可以帮助你。

+0

@hoosssein已经调用了'form.setMultipart(true)'。 – andPat

0

我现在有同样的问题。这里是我如何修复:

我的外部和内部窗体都有setMultipart(true),它按预期工作。