为什么@InterceptorRef在List upload Files中不起作用

时间:2017-12-13 11:22:01

标签: java upload struts2 annotations

当我为我的List使用自己的@InterceptorRef Annotation时,List为空。我很困惑,因为默认拦截器工作,然后列表有两个选定的图片。作为预防措施,我只尝试使用第一个Interceptor,它也没有用。我不知道我做错了什么。请帮我。

带注释的我的操作方法看起来像

@Action(value = "fileUploading", results = { @Result(name = "success", location = "nextGui.jsp"),
        @Result(name = "input", location = "testGui.jsp") }, interceptorRefs = {
                @InterceptorRef(params = { "allowedTypes", "image/jpeg,application/zip", "maximumSize",
                        "100000000" }, value = "fileUpload"),
                @InterceptorRef("defaultStack"), @InterceptorRef("validation") })
public String upload() throws Exception {
    for (File file : fileUpload) {
        System.out.println("File :" + file);
    }
    for (String fileName : fileUploadFileName) {
        System.out.println("Filename : " + fileName);
    }
    for (String fileContentType : fileUploadContentType) {
        System.out.println("File type : " + fileContentType);
    }
    System.out.println("Ende");
    return SUCCESS;
}

0 个答案:

没有答案