• 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

how to download excel sheet from unix operating system

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I am creating an excel sheet and storing it in application server which runs on HP-UNIX OS. I want to download that excel sheet using jsp page. I tried the following code, but its giving the page cannot be displayed error. Is there any other way to download the excel sheet from jsp page.
<%
out.println("<a href=\"../XlsDownload/Download.xls\">Download</a>");
%>

Thx in adv.

ritu
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try doing this Ritu:



the above will also work, but you may want to replace the 'x-download' with the specific format for excel files. i dont know what that is.

the difference would be that, browsers that recognise the format will open the file for you in Excel automatically while others will show the 'save as' or equivalent dialog box.
 
Neeraj Dheer
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ritu,

In this case, the code in the above post will set the content type. But when you set te content type as above, that means that you want to download the file specified by 'fileName'. And then you use the OutputStream of the servlet to stream the actual bytes of the file.
So, the effect of the above code is to produce the 'save-as' pop-up dialog box and save the file onto the client.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ritu Pande:
hi,

I tried the following code, but its giving the page cannot be displayed error. Is there any other way to download the excel sheet from jsp page.



What errors are you getting?
Disable the "Friendly error messages" feature in your browser and you should see a more descriptive stack. If not, look in your containers logs.

You should be able to use a regular anchor tag.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ritu
Is the problem resolved? What was the issue?Please let me know, even I want to download a simple .csv file from my linux box...

Thank..
Ravi..
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ June 21, 2005: Message edited by: Mark Spritzler ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Aniken Aniken"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Aniken
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
used
import org.apache.struts.actions.DownloadAction;

struts-config.xml

<action path="/download"
parameter="download_function"
type="com.MyDownloadAction"
name="MyForm"
scope="request"
input="/invoke_download_action">
<forward name="success"
path="/download_now.do"
redirect="false"/>
<forward name="failure"
path="/download_failure.do"
redirect="false"/>
</action>

<action path="/download_now"
parameter="download" type="MyDownloadAction"/>
 
Neeraj Dheer
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aniken Aniken...please change your name to comnfirm to the naming policy as Mark mentioned...

what you are doing is similar to what i mentioned in my post...
however Ben's idea of using the anchor tag seems profoundly simpler than doing all of that...

the error, and i am only speculating, probably is because the path is somehow not right???
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic