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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:53:52+00:00 2026-05-24T07:53:52+00:00

Im using struts2 and also servlets. (Due to a 3rd party ajax thing that

  • 0

Im using struts2 and also servlets. (Due to a 3rd party ajax thing that ships with servlets).

One of my forms is posting to a servlet. (Name “/exclude/new.srl”)
I’ve set struts2 up to ignore all requests to the “exclude” namespace.
So the request is reaching the servlet just fine.

The servlet does its job, and then goes on to do the following before ending:

response.getOutputStream().print("'OK'");
response.getOutputStream().close();

Now i dont know the 3rd party software in detail, so im not exactly sure, but i think the OK statement tells my 3rd party ajax-solution to close the form and refresh some contents of the page.

This all works fine.

Now however i am trying to add a new bit to this. I would like send a file to the user. In other words, when the form is submitted, everything that used to happen should still happen, but also the user should be asked to save or open a file.

So I have created a struts2 action that will return the file, no problem.
But how can i program the servlet to push this file to the user AND ALSO return response OK?
I do not need to use the struts2 action to push the file, if it can be done from within the servlet that is perfectly acceptable.

Anyone?

  • 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-05-24T07:53:53+00:00Added an answer on May 24, 2026 at 7:53 am

    You will probably have to setup your unmentioned 3rd party ajax-solution to forward to the file action/servlet URL on form submission success (ie redirect to file download after form was submitted ok).

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

Sidebar

Related Questions

Well.. we've developed a j2ee application using struts2 ajax capabilities. We find that the
One of actions in Struts2 is using below code: java.util.concurrent.ExecutorService myservice = Executors.newSingleThreadExecutor(); myservice.execute(new
While using Struts2, I am using several annotations to do my validations inside the
I am using Struts2, Spring 2 and Junit 4.5. My main question is, whether
I am using struts2 to build a web application and I use struts2 tags
I needed to create an application using Struts2 as MVC,Hibernate for data access and
The registered accounts in my web application (Created using struts2) gets a separate site
I use tomcat. I am developing a web application using struts2, and I use
I'm using tomcat 6.0 and struts2. When I try to click on a link
I am developing project using Spring , Struts2 & Hibernate . Now I want

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.