Solved

struts action - forward to file dialog

Posted on 2004-09-16
6
514 Views
Last Modified: 2012-05-05
I am wanting to open an excell file from the Struts action class

My code in the Sruts action class looks as follows:
ActionForward af = new ActionForward("/userdata/test.xls");

It opens a dialog box.

My problem is the name of the file(instead of test.xls) is the name of the .do function called from my JSP to run this action.
0
Comment
Question by:javaone
  • 2
  • 2
6 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 63 total points
Comment Utility
in your action, can you do:

  response.setContentType( "application/xls" ) ;

then write the excel file to the stream you get from

  response.getOutputStream() ;

?
0
 
LVL 4

Assisted Solution

by:Rick_Townsend
Rick_Townsend earned 62 total points
Comment Utility
you could do a redirect

response.sendRedirect("userdata/test.xls");

or just have whatever link you're using point directly to the file.
0
 
LVL 4

Expert Comment

by:Rick_Townsend
Comment Utility
Say, the date on this question is more than two weeks old.  Should it be closed due to author inactivity?
0
 
LVL 35

Expert Comment

by:TimYates
Comment Utility
> or just have whatever link you're using point directly to the file.

You will have to check that you have the correct mime-type in server.xml for this to work, but it should work too :-)

>  Say, the date on this question is more than two weeks old.  Should it be closed due to author inactivity?

Probably ;-)  Hehehe, I imagine there will be a flurry of cleanup activity sometime this month :-D
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 56
withoutTen challenge 14 88
changeXy challenge 13 56
drawing animated level bar based on numbers 3 71
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now