Hi i am trying to download a .xls file from server but i cant

I am using Tomcat 5.0, Where i am trying to download a .xls file.. which was uploaded by me.. when i try to download the file using line.. the content of the jsp file is there in the .xls file, i cant get the original .xls file
here my code.. i am request this page by a button click...
browser ask me to save download.jsp file....
how to download a .xls file from the server... the file was uploaded by me to a folder temp
<%@ page
contentType="application/vnd.msexcel; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<jsp:include page="http://localhost:9999/temp/B.xls"/>

Help me please, I have this:
File ficheroXLS = new File(strPathXLS);
FacesContext ctx = FacesContext.getCurrentInstance();
if (!ctx.getResponseComplete()) {
String fileName = ficheroXLS.getName();
String contentType = "application/vnd.msexcel";
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
response.setContentType(contentType);
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
ServletOutputStream out = response.getOutputStream();
out.write({color:#ff0000}ficheroXLS.toString().getBytes(){color});
out.flush();
out.close();
ctx.responseComplete();
My
problem is marked with red color, I have a file. XLS and I want to
download it, but to put what this red just showed me the PATH ...
How can I do to make the contents of this file?
What type of object must be the xlsReport?
thanks greetings

Similar Messages

  • I am trying to delete an XLS file from a network drive and am getting a message that says the file cannot be deleted because it is in use.  I can't see where it is in use and have tried to reboot the computer to no avail.

    I am trying to delete an XLS file from a network drive and am getting a message that says the file cannot be deleted because it is in use.  I can't see where it is in use and have tried to reboot the computer to no avail.  I can delete other files but several XLS files are giving me this message.

    You said it was a network drive.  So is someone else on the network using that same file or may have have left with excel still accessing it on their system?

  • I've downloaded a zip file from noisetrade, but it won't open on my mac...what shall I do?

    Hey guys, wondering if someone could give me some help. I've downloaded a zip file from noisetrade, but it won't open on my mac.I keep clicking and it vhanges to a cgzp file..and even when I changed the end bit to zip, it won't open. I've tried the unarchive app andthat hasn't worked either...what shall I do?
    Thanks in advance :-)

    iWork (no 's') for iOS & iWork for Mac have not gone away.
    iWork.com (beta) (also no 's') is going away the end of July. iWork.com (beta) is/was an online method of sharing iWork files with other users & never moved out of beta in 3+ years. It is a completely different entity than the iWork apps & is not & never has been necessary for the iWork apps to function.
    A Numbers document, as well as Pages or Keynote documents, cannot be opened on a PC. You must first export them to a file that a PC can use. For Numbers that is generally Excel. In Numbers on your iPad tap the wrench & then tap Share & Print & choose Excel as the file type.
    As for transfering a file from a PC to an iPad, I'm not sure as I don't use a PC.

  • I tried to download picture/video files from iPhone 5S to MacBook Pro but it won't stop importing and I don't have phone connected.  I need to shut down the computer and I can't stop the import from spinning

    I tried to import picture/video files from iPhone 5S to MacBook Pro Aperature.  It appeared to be trying to download every picture I have ever taken even tho I checked do not import duplicates.  The phone is not connected to lap top.  It has been spinning for 1/2 day.  I can't stop it. I can't shut down the computer. How do I stop the import and shut computer down.

    Hey L. DENISE,
    I recommend that you use the following article to help you address this issue:
    OS X: How to quit an unresponsive application using Force Quit
    http://support.apple.com/kb/ht3411
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • Getting Server Busy window when trying to download a .pdf file from any web site.

    When the "Server Busy" window opens, there are 3 choices: switch to; retry; cancel. I select switch to; it starts downloading the file, but appears to be stuck/locked up at a certain point. I usually have to go to Task Manager and cancel the download. Sometimes, after trying different things, the .pdf succeeds in downloading' can't tell what does/doesn't work. Retry doesn't do anything. Cancel doesn't close the Server Busy window.

    See: http://helpx.adobe.com/x-productkb/policy-pricing/configuration-error-cs5.html

  • How could I download a PDF file from Server

    I have a PDF file at the Server side , and I want to download and show it using Java, how could I do it.
    Thanks

    If a file exits in the Server side u can just point u'r URL to that file.

  • Eror downloading a XLS file on the portal hosted struts/j2EE application

    guys,
    1st of all please bare with for writing such a huge mail but to explain the scenario i had to do this.
    i am trying to download a XLS file from the web application (struts/J2EE) hosted on the portlet.
    on my portlet i have few text boxes and a button.
    onlcik of the buton there are few validation javascripts and if the valdatin is thrugh then the form is submitted.
    there are 2 ways i can submit the form to the struts action class.
    both approaches have some problem or the other.
    Apporach 1
    var postUrl = document.getElementById('getReportURL_$$PORTLET_ID$$').innerHTML;
    var post = new PTHTTPPOSTRequest(postUrl, form, handleInlinePostResponse_$$PORTLET_ID$$);
    post.invoke();
    this is like a AJAX request post where the response comes back in the function handleInlinePostResponse_$$PORTLET_ID$$ which can be then handled.
    Problems
    1. as from action class i am trying to send a XLS file, i am writing the byte stream of the XLS file on the output stream of the response. when the response reaches the function handleInlinePostResponse_$$PORTLET_ID$$ on portlet jsp it gives me an javascript exception 'End of file reached in invalid state for current encoding' but while sending the response i am encoding the byte stream.
    the code snippet from the action class is as below
    response.reset();
    response.resetBuffer();     
    response.setHeader("Content-disposition", "attachment; filename=" + reportData.getFilename());
    response.setCharacterEncoding("UTF-8");
    response.setContentType("application/vnd.ms-excel");
    response.getOutputStream().write(reportData.getContent()); //byte[] form of the XLS file
    return null; //as we write on the response out stream the response is already commited hence the return null has no significance.
    2. in case of the any exception on server side this approach is helpful as the error content jsp is rendered in to the portlet from where the action was fired.
    Approach 2
    form.action = "<pt:url xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:href='downloadCommercialXLSReport.do'/>" ;
    form.submit();
    This approach is normal for submitting any struts from bean to the struts action class (i know this is not a aprropriate way to submit d form through portlet as it submits whole page inclusding all the portlet data)
    Problems
    1. here in case of the sucess the XLS file is returned to the browser which openes a browser specific dialogue box having 'Save' 'Open' and 'Cancel' buttons to save/open the XLS file. (please note no javascript exception occurs here as approach one as the byte streeam content is returned to the browser directly and not to any post response handler function as handleInlinePostResponse_$$PORTLET_ID$$)
    2. But here the problem is in case of any sever side exception the error jsp is rendered on whole browser page and not in portlet which is kinda goofy.
    so now i am in a catch 22 scenario each approach has 1 problem either in success or in failure flow.
    can sombody suggest me a way out from this as i desperately need to download a XLS file.
    lemme kno if anybody has done a similar download stuf through portal server.
    regards,
    Sush

    i have done this before although it was in .net. try the first approach but first pop to a new window....the xls response has to be the only response to the browser or else the browser will take the other bytes returned as garbage and call the stream corrupt. let me know how this goes for you.
    if you still have problems i can post the code that worked for me. it is in c# but looks very similar.

  • Tried to download Mountain Lion 10.8 upgrade but it failed even though my card has been charged

    I tried to download Mountain Lion upgrade from Lion but it failed even though my card has been charged

    http://www.apple.com/support/mac/app-store/contact.html?form=account

  • Reading XLS file from url

    I'm trying to read a XLS file from a URL.
    What exactly the code is trying to do is this:
    User clicks on a button in a webpage for select a xls file . The file selected may be read and a method write a txt file on another server.
    How can i do this?
    Many thanks.

    Hi,
    Check whether path ur providing to the open data set stmt is correct or not in debugging mode.
    * File upload to internal table from UNIX Directory
        IF NOT p_i1file IS INITIAL AND NOT p_path IS INITIAL.
          CONCATENATE p_path p_i1file INTO v_file.
          CONDENSE v_file.
          OPEN DATASET v_file FOR INPUT IN TEXT MODE MESSAGE v_msg.
          IF sy-subrc EQ 0.
            WRITE:  / 'INPUT FILE CONTAINS NO RECORD :'(010), v_file.
            DO.
              CLEAR tbl_input.
              READ DATASET v_file INTO tbl_input.
              IF sy-subrc NE 0.
                EXIT.
              ELSE.
                APPEND tbl_input.
              ENDIF.
            ENDDO.
    * Close Input File
            CLOSE DATASET v_file.
          ELSE.
            WRITE:/'Error uploading file: '(008),v_file.
            STOP.
          ENDIF.
        ENDIF.
    It should work.check the sy-subrc value and file value in debug mode.
    Thanks
    Parvathi

  • Extract .xls file from an FTP site

    Hi everyone,
    Can anyone assist with this, I'm trying to extract an .xls file from a FTP site. The system I'm currently working on has no SAP application installed, we are using Microsoft SQL server as the target database and there is an FTP site which contains the .xls/.csv files and Data services as a ETL tool.  The error I'm getting is  'FTP could not transfer file </DI_TEST/DATA_TO_IMPORT_1.xls> from host <www.servername.com>: <T>. Please ensure that the FTP relative path for the SAP server working directory is set correctly such that the data file is accessible to the FTP program. Also, ensure that the target path, where the transferred file is written to, is correct.'
    Do I need to have SAP installed to use this functionality?
    Currently to make this work, I wrote a .CMD file to do the GET ftp code and I then call this with a DI script and it works perfectly. Isn't there a way I can do this independant of the .CMD?
    I'm sorry for bring this up again, I know I had a similar thread before. The reason why I closed it is that I did it using .CMD, I would prefer if I can do it with DI without using .CMD.
    Thank all for your help.
    Kind regards,
    Edited by: gsecure on Apr 19, 2010 10:26 AM
    Edited by: gsecure on Apr 21, 2010 11:08 AM

    Hi There,
    I've a similar issue. Can anyone assist with this, I'm trying to extract an .xml file from a FTP site. The system I'm currently working on has no SAP application installed, we are using Microsoft SQL server as the target database and there is an FTP site which contains the .xml files and SAP Data services as a ETL tool.
    Thank you
    Mohan

  • Access/download file from server.

    have a problem. When I am trying to save/open a file from server(secure) which uses HTTPS, its displaying error message:
    Internet Explorer cannot download ...File_name.doc from Server_name.
    Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
    My code is below. Please help me out.
    Its working with my localhost(http) and with Firefix browser. Its something to do with http and IE 6.
    <java>
    if (!request.getScheme().equals("https"))
    response.setHeader("Pragma", "no-cache");
         String fileName=request.getParameter("instruction");
         //filename = filename.replaceAll( "\\W*", "" ) ;
         String DirName = request.getParameter("directory");
         String value = (DirName+"/"+fileName);
                   File f = new File (value);
                   response.setContentType("application/msword");
                   //set the header and also the Name by which user will be prompted to save
                   response.setHeader("Content-disposition", "attachment; filename=" + fileName);
                   InputStream in = new FileInputStream(f);
                   out.clearBuffer();          
                   int bit = 256;
                   int i = 0;
                   try {
                        while ((bit) >= 0) {
                             bit = in.read();
                             out.write(bit);
                   } catch (IOException ioe) {
                        ioe.printStackTrace(System.out);
                   out.flush();
                   out.close();
                   in.close();     
    </java>

    HI,
    To avoid redirection, Safari users are having good luck with Open DNS Free / Basic
    Carolyn

  • I am trying to download an epub book from the library, which I have been doing for almost a year. Now I am being asked for my adobe id, which I enter and I get an error message stating Adobe Activation Request Error:2004.. What's this ?

    I am trying to download an epub book from the library, which I have been doing for almost a year. Now I am being asked for my adobe id, which I enter and I get an error message stating Adobe Activation Request Error:2004.. What's this ?

    I downloaded Blue Fire Reader and it requested an adobe id. I clicked on the link that was in the error message stated http//adeactivateadobe.com. Found out that if the date and time on my Ipad is wrong that it won't let me download a book. I was off 5 hours. I reset my clock settings and adobe id let me download a book from the library. I am back to using Overdrive and adobe again on my ipad.
    Thank you.

  • HT1926 I tried to download the latest version of iTunes but now seem to have lost everything and can not access my library at all. Instead i keep on receiving the message 'Application has failed to start because MSVCR80.dll was not found. I cannot access

    I tried to download the latest version of iTunes but failed half way through. It suggested that i reinstall we I tried. However, i now get this message which states "Application has failed to start because MSVCR80.dll was not found. Reinstalling the application may fix the problem"
    I have tried this but with no success. I have therefore found that I cannot access my iTunes library at all now.
    What should I do.

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99792)

  • I am trying to download iTunes to my Sony PC,  but "This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer Package."

    mI am trying to download iTunes to my Sony PC, but I keep getting the following error after initial download attempt:
    "This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer Package."
    I have Windows 7 Home Premium, Service Pack 1.
    Any help is greatly appreciated.

    Hi gump68,
    Thanks for visiting Apple Support Communities.
    You may find the steps in this article helpful if iTunes is not installing on your PC:
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    All the best,
    Jeremy

  • I just got an iPod 4th generation and Im trying to sync my iTunes songs from my dell laptop on to my iPod but it says I need iTunes 10.6.3. So I tryed to download it on the apple website but it keeps saying that there is an error. Any answers?

    I just got an iPod 4th generation and Im trying to sync my iTunes songs and books from my dell laptop on to my iPod but it says I need iTunes 10.6.3. So I tryed to download it on the apple website but it keeps saying that there is an error. I have already tryed uninstalling all Apple Inc. programs on my laptop then trying to install iTunes again but that has had no success what so ever. I have started to get very frusterated with this . Hopefully someone can help. I would really appreciate it. Any suggestion?

    So I tryed to download it on the apple website but it keeps saying that there is an error.
    What does the error message say? (Precise text, please.)

Maybe you are looking for