• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with file's name in download dialog

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a minor problem with sending a file to the client. I have an action that gets an Excel file from a remote database and sends it to the browser using the following code:



The struts-config:


I (have to) use Struts 1.1. Sometimes the browser's download dialog doesn't show the correct filename but the action's name (searchProtocol) instead. Debugging assured that the FileData object is correctly filled and returns the proper name and the header's mime-type is correct as well. The files itselves are always okay/undamaged. It seems as if it somehow depends on the selected file because some files always show the correct names, others never.

Any ideas what can cause this?
[ February 08, 2008: Message edited by: Mike Himstead ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a drive-by comment about this line:

AvailableDoesntDoWhatYouThinkItDoes
 
Mike Himstead
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe,

thank you for your comment. Is there a mistake or typo in the FAQ? The line


doesn't seem to be correct. I guess what meant is:



Or am I wrong?
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct. I updated the FAQ.
I looked at the code I'm using to do the same task. It looks very much like yours, but is working correctly. Perhaps some of the file names you are coming up with aren't valid and the browser is falling back on the action name? What names are giving you trouble?
 
Mike Himstead
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
*slapsforehead*

The filenames contained a slash ("/") which can't be in a filename (at least on Windows platforms). Thank you for your input and have a nice weekend.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
reply
    Bookmark Topic Watch Topic
  • New Topic