Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

struts action - forward to file dialog

Posted on 2004-09-16
6
Medium Priority
?
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 252 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 248 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

609 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