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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:57:42+00:00 2026-06-11T07:57:42+00:00

i have a struts action that’s have a doc as response this is the

  • 0

i have a struts action that’s have a doc as response this is the code :

public class GenerateBlame extends Action
{ 



    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws IOException {
        System.out.println("it's ok!");
        POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("C:\\Users\\free\\Desktop\\myworkspace\\gestionRH\\WebRoot\\fiches\\decisionRetraitSanction.doc"));
        HWPFDocument doc = new HWPFDocument(fs);
        Range r = doc.getRange();
        r.replaceText("<dateDemande>", "test");

        doc.write(new FileOutputStream("C:\\Users\\free\\Desktop\\myworkspace\\gestionRH\\WebRoot\\fiches\\decision.doc"));
        OutputStream out = response.getOutputStream();
        response.setContentType("application/rtf");
        response.setHeader("Content-Disposition","attachment; filename=Decision");
        FileInputStream in = new FileInputStream("C:\\Users\\free\\Desktop\\myworkspace\\gestionRH\\WebRoot\\fiches\\decision.doc");
        byte[] buffer = new byte[4096];
        int length;
    /*  while ((length = in.read(buffer)) > 0){
            out.write(buffer, 0, length);
        }
        in.close();
        out.flush();*/
        return null;
    }
}

i want to call this action via ajax id do like this :

$.ajax({
  type: "POST",
  url: "../generateBlame.do",
 });

i can’t get the file downloeded as i’did whith a form

  • 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-11T07:57:43+00:00Added an answer on June 11, 2026 at 7:57 am

    You need to use something like this jQuery download plugin or equivalent.

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

Sidebar

Related Questions

I have a model-driven Struts Web action: public class ModelDrivenAction<T extends Object> implements ModelDriven<T>,
In the execute method of the Struts Action class, we have the following four
I have some code within struts.xml like: <action name=viewApplicationPDF class=com.xxx.abc.web.action.XApplicationPDFAction> <result name=success>/WEB-INF/templates/xApplication.jsp</result> </action> I
Hi I have something like this in struts.xml <action name=LoginAction class=controller.LoginAction> <result name=error>/Error.jsp</result> <result
In my struts.xml I have: <action name=file_save method=fileSave class=FileActionBean> <interceptor-ref name=fileUpload> <param name=maximumSize> 5242880
I want to generate xml file from Struts action object. So that I have
I have a problem with authorized SSL connection. I have created Struts Action that
I've Struts 1 action class (actions are singletons by design in struts 1) that
If a struts 2 action class have a property of List<User> userList . And
I am working on struts2. In my action class I have written some accessors

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.