2

When I use a own @InterceptorRef Annotation for my List then the List is empty. I'm confused because the Default Interceptor works and then the list has for example the two selected Pictures. As a precaution, I only tried it with the first Interceptor, which didn't work either. I don't know what I did wrong. Please help me.

My Action Method with the Annotation Looks like

@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;
}
Jiri Tousek
  • 12,211
  • 5
  • 29
  • 43
  • The default interceptor stack includes file upload interceptor. While defining it twice per configuration might produce unexpected results. – Roman C Dec 13 '17 at 14:36
  • how do i override this upload interceptor? –  Dec 14 '17 at 07:28
  • interceptor overriding is done while defining it to the action config. if you need learn more about it you can read [this](https://stackoverflow.com/a/28045287/573032) answer. – Roman C Dec 14 '17 at 16:45
  • https://www.concretepage.com/struts-2/struts-2-annotation-file-upload-example-single-multiple this example and there they has written this example. –  Dec 18 '17 at 10:27
  • I get an error message and after removing the @InterceptorRef("defaultStack") the error no longer appeared. But there is again nothing in the List. –  Dec 18 '17 at 10:51
  • Nothing in the list is a result of errors that you are missing. – Roman C Dec 18 '17 at 16:21

0 Answers0