Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8653581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:34:43+00:00 2026-06-12T14:34:43+00:00

I want to develop a web-application with a fileupload mechanism using struts2 with fileUpload

  • 0

I want to develop a web-application with a fileupload mechanism using struts2 with fileUpload which behaves strange and I can’t figure out why.

I configured the fileupload mechanism in the struts.xml:

<package name="com.actions" namespace="/" extends="struts-default">
<action name="excelupload" class="com.actions.FileuploadAction">
    <interceptor-ref name="fileUpload">
            <param name="maximumSize">10000000</param>
    </interceptor-ref> 
        <result name="success">/fileupload.jsp</result>
        <result name="input">/fileupload.jsp</result>

    </action>
</package>

The corresponding JSP:

<s:form action="excelupload" method="post" enctype="multipart/form-data">
    <s:file name="excelfile" label="file" />
    <s:submit name="upload" value="upload" align="center" />
</s:form>

The corresponding Action:

public class FileuploadAction extends ActionSupport{
    File excelfile;
    public File getExcelfile() {
    return excelfile;
}

public void setExcelfile(File excelfile) {
    this.excelfile = excelfile;
}
    public String execute(){
        System.out.println(excelfile.getName());
        return SUCCESS;
    }
}

When I upload a small file everything works fine. But when I try to upload a file that is larger than 2 MB the application throws the following exception:

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request
was rejected because its size (3244109) exceeds the configured maximum (2097152)

To fix this issue I tried to add a struts-default.properties with

struts.multipart.maxSize=20097152

to the root of my the app’s class path.

That fixed the exception but now excelfile is always null, regardless how large the file is.

Does anybody know what I am doing wrong?

EDIT: For deployment I use Tomcat
EDIT: Added missing getter and setter methods.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:34:45+00:00Added an answer on June 12, 2026 at 2:34 pm

    I could fix this issue by removing

    <interceptor-ref name="fileUpload">
            <param name="maximumSize">10000000</param>
    </interceptor-ref>
    

    from the struts.xml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop a web application in JSP ,in which a user can
I want to Develop a web application, which accept fingerprint from client machine using
I want to develop a mobile web application using asp.net 3.5 that can be
I have a school project, for which I want to develop a web application
I want to develop a simple web application using Spring Web Flow. The project
I'm developing a web application using .net/c#/jQuery. I want to develop an AJAX function
I want to develop a web application in Silverlight. Can this reduce my web
I am having Web application using .aspx now i want to develop same application
I want to develop a Web application in Delphi using VCL. I tried UniGUI,
I want to develop a web application which makes it possible to browse an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.