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 7921629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:39:20+00:00 2026-06-03T16:39:20+00:00

I am trying to upload Excel only file in Struts2 WEB Application. So using

  • 0

I am trying to upload Excel only file in Struts2 WEB Application. So using the following Code in Jsp page:

<s:label value="File Name : *" />
<s:file name="fileUpload" label="Select a File to upload"/>
<br>

<br>
<s:submit value="Add" name="add" tabindex="8" /> 



    </s:form>

In Response.jsp page displaying the File content and It’s type as Follows:

   <s:form  action="saveBulkStores.action" method="get" >

<h4>
   File Name : <s:property value="fileUploadFileName"/> 
</h4> 

<h4>
   Content Type : <s:property value="fileUploadContentType"/> 
</h4> 

<h4>
   File : <s:property value="fileUpload"/> 
</h4> 

<br>
    </s:form>

In Struts.xml:

            <action name="bulkStores" class="com.action.FilesUploadAction"
        method="loadBulkStoresPage"> 
        <result name="input">/viewfile.jsp</result>
        <result name="success">/uploadfile.jsp</result> 
    </action> 

            <action name="saveBulkStores" class="com.action.FilesUploadAction"
        method="saveBulkStores"> 
        <interceptor-ref name="exception"/>
        <interceptor-ref name="i18n"/>
        <interceptor-ref name="fileUpload">
            <param name="allowedTypes">text/plain</param>
            <param name="maximumSize">10240</param>
         </interceptor-ref> 
        <interceptor-ref name="params">
            <param name="excludeParams">dojo\..*,^struts\..*</param>
        </interceptor-ref>
        <interceptor-ref name="validation">
            <param name="excludeMethods">input,back,cancel,browse</param>
        </interceptor-ref>
        <interceptor-ref name="workflow">
            <param name="excludeMethods">input,back,cancel,browse</param>
        </interceptor-ref> 
        <result name="input">/uploadfile.jsp</result>
        <result name="success">/success.jsp</result> 
    </action>

In Action Classes:

         public String loadBulkStoresPage(){
    System.out.println("FILES BULK UPLOADS.........");
    return SUCCESS;
     }
         private File fileUpload;
     private String fileUploadContentType; 
     private String fileUploadFileName;
         //Getters and Setters for above Fields.

Displaying filename,content type as follows:

         public String saveBulkStores(){
    System.out.println("check Bulk upload file");

    System.out.println("fileName:"+fileUploadFileName);
    System.out.println("content type:"+fileUploadContentType);
    System.out.println("fileupload:"+fileUpload); 

    return SUCCESS;
     }

Output:

   It's displaying NUll value only for my display statements. So anyone help me to fix this issue. thanks in Advance. 

I am new to do this task.

  • 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-03T16:39:23+00:00Added an answer on June 3, 2026 at 4:39 pm
    FileUtils is not part of the standard JDK, it a class in the Apache Commons IO library.It contains Methods like
    
    FileUtils.readFileToString(file);
    FileUtils.copyDirectoryToDirectory(source, destination);
    FileUtils.deleteDirectory(source);......................which make copying files from one directory to other directory in most easier way in word it reduces voluminous amount of code as entire code is written by Apache people
    please refer this URL for reference http://www.koders.com/java/fid002DB6BD79CABA7B6AA0F2669061424E3B9776D3.aspx
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using HSSF in my web application to read an excel file uploaded
i am trying to upload an excel file and to store its contents in
I am trying to upload a file or stream of data to our web
I'm trying to upload documents to SharePoint using web services attaching custom metadata to
I'm trying to upload a file using Watin and C#. Under Windows XP, Watin
Iam trying to upload the video but when file uploads the following response displays
I trying to upload a newsstand application for ipad. I have a icon file
I am trying to upload file from android sdcard to FTP Web server. For
I'm trying to upload an excel file. I have an ASP.NET test site on
We have created a web application, using ASP.NET, that allows users to upload documents

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.