Solved

struts action - forward to file dialog

Posted on 2004-09-16
6
541 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
ID: 12073989
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
ID: 12230995
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
ID: 12231165
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
ID: 12235414
> 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maxBlock challenge 30 142
isEverywhere  challenge 19 82
Need To Find FireFox Binary Path For Python Selenium On Windows 7 15 724
CONDITIONAL MAX STATEMENT IN T-SQL 3 73
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

829 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