Servlet downloads Excel file ok but also attempts Servlet & JSP files !!

Hi,
My Servlet code downloads a csv into Excel as required BUT it also attempts to download the JSP file (that calls the servlet) and the Servlet file as well.... How do I ensure that only the csv file is downloaded. I am using the following code.
<servlet code>
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
ServletOutputStream out = res.getOutputStream ();
res.setContentType( "application/vnd.ms-excel" );
String report = req.getParameter("report");
filename = report + user_id + ".csv";
String fileURL = the url;
res.setHeader("Cache-Control", "no-cache");
res.setHeader("Content-disposition",
"attachment; filename=" +
report + ".csv" );
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try
URL url = new URL ( fileURL );
bis = new BufferedInputStream(url.openStream());
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
bos.write(buff, 0, bytesRead);
catch(final MalformedURLException e)
System.out.println ( "MalformedURLException." );
throw e;
catch(final IOException e)
System.out.println ( "IOException." );
throw e;
finally
if (bis != null)
bis.close();
if (bos != null)
bos.close();
</servlet code>
thanks in advance

This problems exists whether I try IE4, IE5 or IE5.5.
Netscape is not an option.
The running order in this download is Servlet, JSP then Excel file !!! All I want is for the Excel (csv) file to be downloaded. I do not see any problem with the code, but obviously there is. Please help if you can.
cheers for any solutions.

Similar Messages

  • HT201250 i would like to use time machine but also back up other file to my external drive?

    I just got a WD T3 external hard drive and I would like to use time machine but also back up other files that to the drive.  Can anyone help me out.
    Thanks Mark

    You would need to go to your Applications folder>Utilities>Disk Utility> and there create Two Partitions on your external hard drive, naming them differently.  Then you could go back to your desktop, open the dock, right click on the Time Machine icon and select "Open Time Machine Preferences". In there select the external hard drive Partition that you want to use for TM.  The other external drive partition will be available for other uses.
    Hope this helps

  • I am unable to retrieve spreadsheets.  Numbers displays the "Welcome To Numbers" page but does not allow saved spreadsheets to be opened.  It offers the "Open Recent" choice and displays saved file names but does not allow these files to be accessed.

    I recently upgraded to Numbers 3.5.2.  I have an older Macbook Pro (2009) and I run Yosemite 10.10.2.  I am unable to open any saved files that were created with earlier versions of Numbers.  When I open the Numbers app, I am offered the Welcome To Numbers page.  When I choose the 'Open Recent' option, I am offered the greyed names of files that I had recently used, however, I am unable to open any of these files (no error message is displayed).  Welcome To Numbers stays on the screen.  I tried opening the app by clicking on the file name but it produced the same results.  I am having a similar problem with Pages.   I suspect a compatibility problem between the new OSX and the new iWork offerings.   Has anyone else encountered this problem?  Does it require a setting change or is it a bug?

    I managed to download and install the iWork '09 apps.  However, when I attempt to open the app, I receive this error message:
    Numbers cannot be opened because of a problem.
    Check with the developer to make sure Numbers works with this version of OS X.  You may need to reinstall the application.  Be sure to install any available updates for the application and OS X.
    Problem Details and Configuration:
    Process:          Numbers [39838]
    Path:               /Applications/iWork '09/Numbers.app/Contents/Mac OS/Numbers
    Identifier:          com.apple.iWork.Numbers
    Version          ???
    Build Info:     Numbers-2990000~12
    Code Type:     X86 (Native)
    Parent Process:  ??? [1]
    Responsible:     Numbers [39838]
    User ID:          501
    Any thoughts as to what has to happen next?  I am running the latest OS X available (Yosemite 10.10.2)

  • How do I diable auto compression in cs5? I have tried looking for an option in file handling & and also deleted the preferences file with no luck.

    Please help!

    nataliec76701245 wrote:
    Will that apply to saving psd files as jpegs also?
    Natalie, JPG is a completely different format to PSD, but whereas PSD is loss-less with or without compression (it just takes longer to save with compression) JPG does affect image quality.  But if you use the highest quality settings with JPG, and don't open and save multiple times, you'd be hard pressed to see any problem with JPG images.
    As with so many things, Wikipedia has an excellent page on JPEG compression.
    JPEG - Wikipedia, the free encyclopedia
    I particularly like the sample images towards the end of the article, which demonstrate how the compression works.
    JPEG - Wikipedia, the free encyclopedia
    Image
    Quality
    Size (bytes)
    Compression ratio
    Comment
    Highest quality (Q = 100)
    83,261
    2.6:1
    Extremely minor artifacts
    High quality (Q = 50)
    15,138
    15:1
    Initial signs of subimage artifacts
    Medium quality (Q = 25)
    9,553
    23:1
    Stronger artifacts; loss of high frequency information
    Low quality (Q = 10)
    4,787
    46:1
    Severe high frequency loss; artifacts on subimage boundaries ("macroblocking") are obvious
    Lowest quality (Q = 1)
    1,523
    144:1
    Extreme loss of color and detail; the leaves are nearly unrecognizable

  • How to create html files while the request to a jsp file of same

    Hi..
    i need to create html thumbnails during the runtime for a jsp page. so that i can display it in a table (number of pages.). For that, i need to create html pages for each and every request to that jsp file with different data. please help me in this..
    Thanks
    Suresh S

    I believe you will need to more clearly describe what you are trying to do and what the problem is that you are having before you get a reply to your question.

  • HT201258 How do install windows 8 with a windows setup.exe file on my mac?  I have a legal download purchase from windows but it is in exe file not ISO.

    I have the setup.exe for windows 8 .. Not the ISO file .. How can I install w

    You need to run the .exe on a Windows machine, which is a Download Manager for the ISO. It will let you create a DVD, ISO or a USB media.

  • Have download  adobe digital 4. but it says that a file is missing when I try to download my book to kobo

    Have just downloaded adobe digital editions 4 and it is saying that a file is missing when I try to download a library book to my kobo

    How To Fix Msvcr80.dll Not Found or Missing Errors
    http://pcsupport.about.com/od/findbyerrormessage/a/msvcr80-dll-not-found-missing -error.htm
    You man need to delete iTunes on your computer and then reinstall.
    How To Completely Uninstall and Remove All Traces of iTunes
    http://zardozz.com/zz/2008/04/how-to-completely-uninstall-and-remove-all-traces- of-itunes.html/
     Cheers, Tom

  • Dreamweaver reports file "not found" when attempting to open files from SMB server...

    User's work-files are hosted on a Windows Server 2003 SP2 volume accessed via SMB. She's been opening and saving the files from the server successfully in Dreamweaver for years from other Macs running Dreamweaver CS4.
    Now she has an iMac running 10.7.4 and Dreamweaver CS6... and it's not the SMB problem you'd expect.
    She mounts the server volume. She opens and saves files normally with full r/w permissions from any app... except Dreamweaver. For any file that she attempts to open in Dreamweaver -- whether from the Finder or from within Dreamweaver -- Dreamweaver pops up an alert reporting that the file at the file-path was not found. The same file is easily accessible from other apps and from the Finder. She continues to have full read/write access to the shared volume.
    Local copies of the files do not have the problem. It only affects files hosted on the server and it only happens in Dreamweaver.
    So, I create a new user account and everything works fine... The user mounts the sharepoint, opens a file with Dreamweaver... perfectly normal. Then she quits Dreamweaver and relaunches it... everything's fine. Repeatedly. It all works normally. She quits Dreamweaver and unmounts the share, then she mounts the share again and tries to open a file in Dreamweaver again... and it reports that the file was not found.
    This is reproducible: If the server volume has been mounted and unmounted repeatedly under any user account, that triggers the error which continues occurring under that user account from that point on. A restart will not fix it. A safe-boot will not fix it. (In fact, restarting seems to trigger the problem by unmounting the volume.)
    I tried trashing the entire contents of the ~/Library folder in one of the test-user accounts. It doesn't fix the problem. Once it strikes a user account, the only temporary fix seems to be using a new user account. And that's like a ticking time bomb just waiting for the problem to pop up again.
    Any ideas?
    TIA!!

    I've seen on two computers so far. Looking at the mount point under unix, the share is being mounted at two different locations. This is normal behaviour for Macs when you mount two different shares with the same name.
    From terminal I run:
    df
    Which returns something like
    /dev/disk0s2                           1951845952 224463456 1726870496    12%    /
    devfs                                         360       360          0   100%    /dev
    map -hosts                                      0         0          0   100%    /net
    map auto_home                                   0         0          0   100%    /home
    //[email protected]/website  204360384  38067872  166292512    19%    /Volumes/website
    //[email protected]/website  204360384  38067872  166292512    19%    /Volumes/website-1
    map -fstab                                      0         0          0   100%    /Network/Servers
    Notice that the share "website" has been mounted once as website, and again as website-1. This is the underlying unix name for the share, which is how most programs (99% sure including Adobe suite products) will reference files. So, if it thinks that the file is at /Volumes/website/site/index.html but can only see /Volumes/website-1/ then it doesn't know what to do.
    The confusion arises because both will show in Finder as "website". Even more annoying is that Finder does not always unmount shares correctly, so that /Volumes/website might not be accessible but /Volumes/website-1 will be. As far as the user is concerned, the share "website" is still mounted, but as far as Dreamweaver is concerned, it isn't, although website-1 is.
    It's the same share, same data, but is being referenced by different names, so does not seem accessible.
    BUT
    I don't have a solution yet, apart from force unmounting both (or rebooting), remounting, and checking that Dreamweaver is using the right share (perhaps by removing and readding from within Dreamweaver).
    Tedious.

  • CS6 Links Window Shows jpeg file name but not tiff or psd file name

    So I have a question, I noticed that in CS5 and CS6 that when i place a jpeg file in Illustrator, the file name does appear in the links window, but when i place a tiff or a psd file there is no file name in the links window, this drives me nuts.  Is there a way to see the files name of placed psd and tiffs in the links window?

    Here's my thoughts...
    1. You are a bit confused and I wonder how you can determine a file is a PSD or a TIF by looking at it?  Not all print drivers can recognize PSD's, but can recognize TIF ( this means almost all output devices can interpret TIF's no problem ).  That said, PSD's can manage layers better than TIF's which add to file size each layer you include in the TIF.
    2. Never say never.  This all depends on the file's use.  Layered TIFs can add complexity in which a print driver can or cannot deal with.  As you work on an image, you may want to merge layers for whatever reason(s) and you always have the option to flatten whenever you feel like it.  However, It is also a good idea to dupe the file as you move along.  That means you always have a layered version to fall back on should you need to edit later on.  I also Place transparent PSDs in Illustrator files with no problems.  But, I save as EPS in Illustrator and when I do that, then the file is automatically flattened.  This is perhaps what the internet was talking about.
    3.  Yes, see number 2 above.  There's no such thing as automatic flattening of TIFFs.  Again, this all depends on the printer and whether or not it can print while retaining original layers.  Some do, some don't.  Most of the time, I edit in PSD with layers intact.  Then, when I prep the file for printing, I will save a copy as a flattened TIFF so the file streamlines through the RIP and Print process.
    4.  Makes no difference.  Use 'em if you've got 'em.
    Try to get some good resource material at a library or college bookstore or barnes & noble.  Also, get Adobe's Print Publishing Guide.  This is a good reference guide.
    Message was edited by: John Danek

  • Included JSP files not seeing JavaScript in main JSP file

    Hi All,
    I have a JSP page that defines a JavaScript block in it's HEAD block and then includes multiple JSP pages in it's BODY block. Calling a JavaScript function from any of the included JSP pages is met with the following JavaScript error:
    JavaScript Error: [unknown origin]:
    showBatchDetail is not defined.
    I'm not sure what is wrong here since the JSP is generating on the server side and everything is fine by the time it gets to the client side. The entire client side file should be seeing the JavaScript block that was included in the main file.
    Any help here would be much appreciated.
    Steph.
    Some barebones code appears below:
    Main.jsp
    <HTML>
    <HEAD>
    <TITLE>UNIT INFO</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    function showBatchDetail(batchKey)
    var url = "/pditools/html/SfmReports/ShowBatchDetail.jsp"
    + "?batchKey=" + batchKey;
    document.location = url;
    </SCRIPT>
    </HEAD>
    <BODY>
    <%@include file="ShowBatchSummary.jsp"%>
    <%@include file="ShowUnitDefects.jsp"%>
    <%@include file="ShowUnitHistory.jsp"%>
    </BODY>
    </HTML>
    ShowBatchSummary.jsp
    <TABLE>
    <TR>
    <TD>
    BATCH SUMMARY
    <A TARGET="_blank" HREF="JavaScript:showBatchDetail(1000);">(Batch Detail)</A>
    </TD>
    </TR>
    <TR>
    Show some data ...
    </TR>
    </TABLE>

    The problem is not about include but about link use
    ----ShowBatchSummary.jsp----
    <TABLE>
    <TR>
    <TD>
    BATCH SUMMARY
    <A TARGET="_blank" HREF="#" onclick="JavaScript:showBatchDetail(1000);">(Batch Detail)</A>
    </TD>
    </TR>
    <TR>
    Show some data ...
    </TR>
    </TABLE>
    -------end of ShowBatchSummary.jsp--------

  • Tried to download the file "How to Adjust Perspective" and the file will not download.

    I get various error messages when I try to download the file; including but not only.. File is truncated, cannot download.  JPEG marker segment is too short.  Not the proper program.
    I don't know what to make of the various error messages.  Help, anyone?

    Can you provide the file's url?

  • File upload problem in java servlets

    hello,
    I want to upload my files.i have used Multipartrequest object.In my form i had included enctype="multipart/form-data".
    I want to upload one or more files .
    So, I made a file input box and then a select option box. With the help of java script i stored the values of the file input box to the select option drop down box.In this way i stored the name and path of the file in the select option drop down box also. Now when i tried to upload all the file in the select option box it is uploading only one file which is the last one selected from the file input box.
    I hope that file name is also getting from the file input box, and that is the reason why it is uploading that file only.I write this code to execute it.
    MultipartRequest multi=new MultipartRequest(request,".",5*1024*1024);
    I want to upload all the files, so what should i do,
    Please help me to solve this problem
    puneet

    Hi,
    First go through the Multipart code and try to study what it does.it does not upload all the fields u submit in a form.it will first parse the servletInputStream which seperates the normal form fields and the "File" field.when u say ENC-TYPE="multipart/form-data" the way in which it is sent is different for normal fields and the "File" field.there'll be boundaries for each field.also for "File" field the filename will be passed in the Content-disposition info(which contains the values of form fields,their names and filename(only for File input)in specific format) .so if u want to upload more files in the same submit use two or more "File" fields.
    If any one else has a better option let me know

  • Jsp files download message!!! URGENT

    Hi,
    Does anyone have an idea about why I'm getting a download message when I try to run my jsp file deployed on OC4J?
    Seems to be a problem with parameters:
    This is what I do in my code:
    pageContext.forward("pag_loginc.jsp?p_idusr=" + strUsr + "&c_password=");
    And then I get a window for saving pag_loginc.jsp

    Yes,
    Works just fine. Which gui were you talking about. I did it through the webui.
    Check out the ora iFS User's Guide. pp 3-10 to 3-14.
    Good luck.

  • File Server Role: Slow access for "opened files" and slow Explorer browsing

    Since we migrated our fileserver from Windows Server 2008 R2 to Windows Server 2012 we are facing two major problems:
    1. Opening files which are already opened by other users takes about 1 minute before the file actually opens. This is not only for Office files such as Excel and Word, but also for other (not office) files. Again, this problem only rises when the file(s)
    is/are already opened by another user. There seems to be a sort of "Lock" check time which is about 45 to 60 seconds.
    2. The other problem is browsing via Explorer through the network drive (all clients are Windows 7 clients). Half of the time there is some kind of "hick up" with displaying the results of the folder. I cannot figure out a patern, but if there
    is no "hick up" then browsing is very fast (also in the busiest times of the working day)... If there is a "hick up" the result can take about 50 seconds to display the content of a folder.
    I suspect the SMB implementation / settings of Windows Server 2012 which are causing the problems...
    Things I tried:
    1. Changed the Oplocks wait time to 10 seconds (which is the minimum). The result is that openening files does indeed go some faster (still taking about 45 seconds).
    2. Disabled SMB2: the result is that browsing is fast... Opening files does go faster. BUT: we are then facing other problems like some files are not able to open... This setting was, after getting a lot of complaints from the users, changed back to enabled
    SMB2.
    3. Within the NIC card properties I disabled "QoS packet Scheduler", "Link-Layer Topology Discovery Mapper I/O Driver", "Link-Layer Topology Discovery Responder" and IPv6 (as we only use IPv4).
    All above with not the promising results.
    The server is a dedicated (virtual machine on vSphere 5.1) fileserver.
    Please Advice since this is not workable, and we have postponed the migration of the fileserver for our aother location.

    Hi Dave,
    I suggest you disable all third party applications like Anti-Virus application to test if it could reduce the waiting time when accessing a file.
    Here are some related threads below that could be useful to you:
    DFS Slowness when Opening Microsoft Documents and Excel Spreadsheets
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/61ec9a99-0027-44cb-815c-0da9276c1c96/dfs-slowness-when-opening-microsoft-documents-and-excel-spreadsheets?forum=winservergen
    Opening files over network takes long time
    http://social.technet.microsoft.com/Forums/windows/en-US/c8ddb65f-8a17-4cee-afd4-dfc09e99d562/opening-files-over-network-takes-long-time?forum=w7itpronetworking
    opening folder or file takes over a minute on Windows 2008R2 File server
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/b9aa98c4-3ef7-4e6d-810d-6099e72b33f6/opening-folder-or-file-takes-over-a-minute-on-windows-2008r2-file-server?forum=winserverfiles
    Best Regards,
    Amy Wang

  • SFTP MGET of large files fails - connection closed - problem with spool file

    I have a new SFTP job to get files from an FTP Server.  The files are large (80mg, 150mg).  I can get smaller files from the ftp site with no issue, but when attempting the larger files the job completes abnormally after 2 min 1 sec. each time.  I can see the file is created on our local file system with 0 bytes, then when the FTP job fails, the 0 byte file is deleted.
    Is there a limit to how large an ftp file can be in Tidal?  How long an ftp job can run?
    The error in the job audit is Problem with spool file for job XXXX_SFTPGet and an exit code of 127 (whatever that is).
    In the log, the error is that the connection was closed.  I have checked with the ftp host and their logs show that we are disconnecting unexpectedly also.
    Below is an excerpt from the log
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.055 : Send : Name=SSH_FXP_STAT,Type=17,RequestID=12
    DEBUG [SSH2Channel] 6 Feb 2015 14:17:33.055 : Transmit 44 bytes
    DEBUG [ChannelDataWindow] 6 Feb 2015 14:17:33.055 : Remote window size decreased to 130808
    DEBUG [PlainSocket] 6 Feb 2015 14:17:33.071 : RepeatCallback received 84 bytes
    DEBUG [SSH2Connection] 6 Feb 2015 14:17:33.071 : ProcessPacket pt=SSH_MSG_CHANNEL_DATA
    DEBUG [SFTPMessageFactory] 6 Feb 2015 14:17:33.071 : Received message (type=105,len=37)
    DEBUG [SFTPMessageStore] 6 Feb 2015 14:17:33.071 : AddMessage(12) - added to store
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.071 : Reply : Name=SSH_FXP_ATTRS,Type=105,RequestID=12
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.071 : Send : Name=SSH_FXP_OPEN,Type=3,RequestID=13
    DEBUG [SSH2Channel] 6 Feb 2015 14:17:33.071 : Transmit 56 bytes
    DEBUG [ChannelDataWindow] 6 Feb 2015 14:17:33.071 : Remote window size decreased to 130752
    DEBUG [PlainSocket] 6 Feb 2015 14:17:33.087 : RepeatCallback received 52 bytes
    DEBUG [SSH2Connection] 6 Feb 2015 14:17:33.087 : ProcessPacket pt=SSH_MSG_CHANNEL_DATA
    DEBUG [SFTPMessageFactory] 6 Feb 2015 14:17:33.087 : Received message (type=102,len=10)
    DEBUG [SFTPMessageStore] 6 Feb 2015 14:17:33.087 : AddMessage(13) - added to store
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.087 : Reply : Name=SSH_FXP_HANDLE,Type=102,RequestID=13
    DEBUG [SFTPMessage] 6 Feb 2015 14:17:33.087 : Send : Name=SSH_FXP_READ,Type=5,RequestID=14
    DEBUG [SSH2Channel] 6 Feb 2015 14:17:33.087 : Transmit 26 bytes
    DEBUG [ChannelDataWindow] 6 Feb 2015 14:17:33.087 : Remote window size decreased to 130726
    DEBUG [PlainSocket] 6 Feb 2015 14:17:33.118 : RepeatCallback received 0 bytes
    DEBUG [SFTPChannelReceiver] 6 Feb 2015 14:17:33.118 : Connection closed:  (code=0)
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 : Disconnected unexpectedly ( [errorcode=0])
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 : EnterpriseDT.Net.Ftp.Ssh.SFTPException:  [errorcode=0]
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 :    at EnterpriseDT.Net.Ftp.Ssh.SFTPMessageStore.CheckState()
    ERROR [SFTPMessageStore] 6 Feb 2015 14:17:33.118 :    at EnterpriseDT.Net.Ftp.Ssh.SFTPMessageStore.GetMessage(Int32 requestId)

    I believe there is a limitation on FTP and what you are seeing is a timeout built into the 3rd party application that tidal uses (I feel like it was hardcoded and it would be a big deal to change but this was before Cisco purchased tidal)  there may have been a tagent.ini setting that tweaks that but I can't find any details.
    We wound up purchasing our own FTP software (ipswitch MOVEit Central & DMZ) because we also had the need to host as well as Get/Put to other FTP sites. It now does all our FTP and internal file delivery activity (we use it's api and call from tidal if we need to trigger inside a workflow)

Maybe you are looking for