2nd execution of download jsp always gives error

I have got a download button in my html which executes the server page Filedownload.jsp. The download executes fine, but I cannot invoke it again without refreshing the html screen. Otherwise I get an error.
This is how the jsp is invoked from my html:
document.location='FileDownload.jsp?ReportTypeDir=' + ReportTypeStr +
'&MonthDir=' + MonthStr + '&filename=' + DownLoadFileStr;
And this is my jsp:
<%@ page contentType = "application/vnd.ms-excel" %>
<%@page language = "java" import = "java.util.*, java.io.*, javax.servlet.*, java.text.*" %>
<%
String filepath = "c:\\Pace\\" + request.getParameter("ReportTypeDir") + "\\" + request.getParameter("MonthDir");
String filename = request.getParameter("filename") + ".xls";
File file = new File(filepath + "\\" + filename);
byte b[] = new byte[(int)file.length()];
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename +"\";");
if (file.isFile())
BufferedInputStream fin = new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream outs = new BufferedOutputStream(response.getOutputStream());
int read = 0;
while((read = fin.read(b)) !=-1){
outs.write(b,0,read);
}//end of while
outs.close();
fin.close();
}//end of if
%>
How can I avoid getting this error message.
Thanks in advance
Nongo

I'm suprised that it even worked the first time. Since your jsp calls response.getWriter() to give you the implicit 'out' variable, it would be illegal to call response.getOutputStream() in your jsp.

Similar Messages

  • App world always gives error after 1 complete sync

    earlier i have used the app world plugin and all was well. 
    now since last week im facing this problem: (phone is storm 9530, and i have upgraded the OS to 5.0 just last week)
    whn compluter starts, and i start google chrome, then goto appworld website, then download (SYNC) any app, all goes succesfully.
    then whn i try the 2nd download (sync) .. the error comes 
    "SYNC ISSUE: There is an issue connecting to BlackBerry World. Please try again"
    i have checked in hte cellphone, the first app is working perfect.
    later if i try syn agian and again at appworld website, the first SYNC is even impossible and has same error.
     If i resrtart the computer, then all goes well , juz like i stated earlier, but only for 1st sync.
    plz provide a solution

    furthermore ... if i try restarting the google chrome, or even through the internet explorer ... cannot even open the appworld website... it juz goes blank with both the chrome and IE.
    however other website work fine

  • A rental a film but i'm not succeding to download it always give a message error , what should i do?

    i'm not succeding to download a rented film , what to do?

    Contact support.
    http://www.apple.com/support/itunes/contact/

  • Report Generation MS-Word always give error

    Hi
    I am using LV 2012 and MS Office 2010.
    I am using report generation toolkit to have a customised output report.
    When I specify output format as excel, I am able to get the desired result but when I specify output format as word, it always throws an error. I checked running the NI examples meant to give output in word but they all fail while the excel reports are perfect.
    Please find attached an error code for one of the example Sample Report(word).vi
    Please suggest the solution.
    Regards,
    Manbir
    Attachments:
    error_doc.JPG ‏20 KB

    We need to see the code in order to say "Here is the error" or "Try doing it this way".  It also gives us something to try, ourselves.  Do you know how to make "snippets", which are .PNG "pictures" of your code that you can simply put into the message using Insert Image?  We can then drag this image into a LabVIEW Block Diagram, and voilà, working code!
    BS

  • Updating CC Desktop app always gives Error code: A12E1

    Ok, this is getting really old. The fifth release of Adobe Cloud desktop app has come out since I purchased CC last December. Every time, the installer fails with error code: A12E1 (see attached). Again, I followed all the instruction regarding renaming the OOBE folder, first as admin user—then as root. The installer always shuts down and crashes the desktop application. I have a MacBook, Intel OS Lion 10.7.5.
    Is Adobe ever going to fix this issue? I am tired of re-installing my Adobe Apps and presets every time the desktop app updates.

    Hi
    Try the steps mentioned in given document :- http://helpx.adobe.com/creative-cloud/kb/a12e1-error-downloading-creative-cloud.html
    Also, share the update on the resolution.
    Sarika

  • PCR (JSP/PAR) gives error eventhough it is successful in DEV,QAenvironments

    Dear SDN users,
    We are getting a Portal Runtime error - when we are trying to start PCR which is based on JSP (PAR file) in Prod environment.
    We could test successfully in DEV, QA and UAT envrionments using same PAR file, but still we are getting this error in Production environment.
    Also, when we tried to test the PCR using individual server in Prod (from a group of servers in Prod), only one server is able to run the PCR, but all other server are failing to load PCR and giving this error. It is very trivial to know why one server is working and others not. And this occurs only in Prod environment. Our basis team tried to restart the server many times, but still unsuccessful. We have upload the PAR using central instance URL.
    Please HELP.
    =============
    An exception occurred while processing a request for :
    iView : com.cvg.pct.hcm.pcr_voluntarytermination.default
    Component Name : com.cvg.pct.hcm.pcr_voluntarytermination.default
    Error occurs during the rendering of jsp component.
    Exception id: 11:03_23/11/10_0014_84931150
    See the details for the exception ID in the log file  
    =============

    Just to add this is also part of exception from Default trace:
    1) After deploying PAR file using CENTRAL INSTANCE URL (the one with IP address of full path and PAR number / irj/portal) using Support > Portal runtime >Admin console > Upload functionality >>>>it is good to check that time stamp is having correct date/time on deployement > temp and pcd directories. Also, it should have similar time stamps on portalapps directories (use Browe deployment to check timestamps on all three directories).
    #1.5#C000876C380C004E0000019700002D04000494E3262E918A#1289603225908#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#X000044802#6768##jdcs00
    72.cmg_P07_89346950#X000044802#6845c830eeb111df87afc5ad876c380c#SAPEngine_Application_Thread[impl:3]_31##0#0#Error#1#/System/Server#Java###Exceptio
    n ID:11:07_12/11/10_0091_89346950
    [EXCEPTION]
    #1#com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Resource^M
    Component : com.cvg.pct.hcm.pcr_involuntarytermination.default^M
    Component class : com.sap.pct.fin.util.isrprocessevent.IsrProcessEvent^M
    User : X000044802
            at com.sapportals.portal.prt.core.PortalRequestManager.handlePortalComponentException(PortalRequestManager.java:969)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:444)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:527)
            at com.sapportals.portal.prt.component.AbstractComponentResponse.include(AbstractComponentResponse.java:89)
            at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:232)
            at com.sapportals.portal.htmlb.page.JSPDynPage.doOutput(JSPDynPage.java:76)
            at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:129)
            at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
            at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
            at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
            at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
            at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
            at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
            at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:
    33)
            at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sapportals.portal.prt.component.PortalComponentException: Error occurs during the compilation of java generated from the jsp
            at com.sapportals.portal.prt.core.broker.JSPComponentItem.getComponentInstance(JSPComponentItem.java:109)
            at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.service(PortalComponentItemFacade.java:355)
            at com.sapportals.portal.prt.core.broker.PortalComponentItem.service(PortalComponentItem.java:934)
            at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:435)
            ... 38 more
    Caused by: com.sapportals.portal.prt.servlets_jsp.server.compiler.CompilingException: Error occurs during the rendering of jsp component
            at com.sapportals.portal.prt.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:2189)
            at com.sapportals.portal.prt.servlets_jsp.server.jsp.JSPCompiler.compile(JSPCompiler.java:81)
            at com.sapportals.portal.prt.servlets_jsp.server.jsp.JSPCompiler.run(JSPCompiler.java:140)
            at com.sapportals.portal.prt.core.broker.JSPComponentItem.compileJSP(JSPComponentItem.java:284)
            at com.sapportals.portal.prt.core.broker.JSPComponentItem.getComponentInstance(JSPComponentItem.java:134)
            ... 41 more
    Edited by: jakk on Dec 1, 2010 7:56 AM

  • Download / Upload queries gives "Error when generating transport dataset"

    Hi!
    I need to transfer some queries from one system to other.
    Systems are not connected with each other, so no TRs are available!
    I am doing like this:
    - running program RSAQR3TR in "old" system
    - downloading a query as TXT file into my local PC
    - running program RSAQR3TR in "new" system
    - uploading TXT file into "new" system and get a message - "Error when generating transport dataset"
    Any ideas?
    Will reward,
    Mindaugas

    Check whether this info is useful,
    Transporting a query
    Transporting a query means only the query itself is transported.
    Importing a query is possible only if a corresponding user group (see below) and a corresponding InfoSet exist in the target client and if the InfoSet is assigned to the user group. To demonstrate the effect of the import options, suppose that the query has the name QU and belongs to the user group BQ in the source client.
    The import option REPLACE overwrites the query QU of the user group BQ in the target client if the user group exists.
    The import option GROUP=ug overwrites the query QU of the user group UG in the target client if the user group exists. In this case, the query is explicitly assigned to a user group in the target client. This target user group may be differnet from the user group in the source client.
    Rgds,
    SaiRam

  • WebLogic 10.3 Workshop - Downloading tutorial examples give errors

    Hi,
    I'm trying to go through the Workshop tutorials. The tutorials that are using examples to be downloaded from Oracle site giving me errors. For example, here are the steps:
    - Tutorial: Struts
    - From the AppXplorer view, click New Example Web Project. Expand Struts and choose Workshop Struts Tour. Click Next. - so far so good
    - In the New Web Project dialog, click Finish. - once I click finish I get the following error dialog:
    Failed to download the example project from Oracle site.
    sun.security.ValidatorException: PKIX path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    PKIX path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    unable to find valid certification path to requested target.
    I'm guessing it has something to do with setting up Java Security Manager inside (or outside) Eclipse. I'll appreciate any help.
    Thanks,
    Yuval

    Any reason why you are using Workshop 10.3 instead of Oracle Enterprise Pack for Eclipse 11g? It likely supports the features you want and is the strategic Eclipse tool. The latest release just came out last week, see:
    http://www.oracle.com/technology/products/enterprise-pack-for-eclipse/index.html
    Some features are only in Workshop 10.3, but that usually only affects a subset of BEA customers that used features deprecated once the Oracle acquisition became complete.

  • Blackberry curve 8520 can't download apps always gives me other devices apps

    When trying to download apps for my BB curve 8520 always get other devices info I have internet access and. Used to be able to conect to a wifi called linksys now it seem I'm been blocked from all conections and info to my phone info called tmobile my sevice provider all iget from them is aditude. They say I shoudnt get apss for iphone nokias laptop ipads. My kids phones are temporarily off for none payment but can use it as amodem to a tmobile laptop. Is it posible they're useing my acount and made restrictions for my phone

    Hello Chrissie24, 
    Welcome to the forums. 
    Try not having your device plugged in while you are searching for the application and then when it asks for you to connect your device then connect it via USB. 
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • I need to update iPad one but always give error ?

    I can't update iPad ?

    What happens when you try and are you getting any error messages/codes ? If you are getting a 'network timeout' error when downloading the update on your computer then try temporarily turning off all your firewall and antivirus software until the download has completed. If you are getting a different error ... ?

  • Loading JSP pages gives error

    I have created a JSP extension file and tried to run it in browser but receive error !!!
    HTTP Status 500 -
    description The server encountered an internal error () that prevented it from fulfilling this request.
    this error message was shown when Tomcat was running.
    and
    HTTP Status 404 -
    description The requested resource () is not available.
    when tried after starting J2EE server.
    in both cases I used URL : http://localhost:8080/test1.jsp
    Any suggestions to resolve this problem???
    Please make it as simple as possible because I am new to Java.
    Thank you.

    Text for the file is as follows:
    <%@ taglib prefix=�tags� tagdir=�/WEB-INF/tags� %>
    <html>
    <head>
    <title>JSP 2.0 Hello World</title>
    </head>
    <body>
    <tags:helloWorld/>
    </body>
    </html>The URL I have tried was :: http://127.0.0.1:8080/test1.jsp
    Is there any specific directory, wherein I need to save this file.......
    Thank you.
    Message was edited by:
    fresh@java

  • Impdp triggers always give error ORA-04071:missing BEFORE, AFTER or INSTEAD

    Hello,
    I am using 11g impdp to create a test system.
    I use this cmd to import
    impdp 'SYS/xxxxx@PWRFUN AS SYSDBA' dumpfile=PWRPROD.DMP logfile=PWRFUNimportPROD.log SCHEMAS=pwrplant TABLE_EXISTS_ACTION=REPLACE
    Then I get this error for all the triggers
    ORA-39083: Object type TRIGGER failed to create with error:
    ORA-04071: missing BEFORE, AFTER or INSTEAD OF keyword
    Failing sql is:
    CREATE TRIGGER "PWRPLANT"."APPROVAL_STEPS_HISTORY" PS_HISTORY
    BEFORE UPDATE OR INSERT ON PWRPLANT.APPROVAL_STEPS_HISTORY
    FOR EACH ROW
    BEGIN    :new.user_id := USER;    :new.time_stamp := SYSDATE; END;
    As you can see, the trigger does contain the word "before".
    When I remove " "PWRPLANT"."APPROVAL_STEPS_HISTORY" " and run the trigger below, it compiles correctly. Why is this, and how do I make my impdp to run correctly?
    CREATE TRIGGER PS_HISTORY
    BEFORE UPDATE OR INSERT ON PWRPLANT.APPROVAL_STEPS_HISTORY
    FOR EACH ROW
    BEGIN    :new.user_id := USER;    :new.time_stamp := SYSDATE; END;

    same error, thanks for your attemp
    Error starting at line 1 in command:
    CREATE TRIGGER "PWRPLANT"."APPROVAL_STEPS_HISTORY" PS_HISTORY
    BEFORE UPDATE OR INSERT ON PWRPLANT.APPROVAL_STEPS_HISTORY
    REFERENCING new AS new
    FOR EACH ROW
    BEGIN :new.user_id := USER; :new.time_stamp := SYSDATE; END;
    Error report:
    ORA-04071: missing BEFORE, AFTER or INSTEAD OF keyword
    04071. 00000 - "missing BEFORE, AFTER or INSTEAD OF keyword"
    *Cause:    The trigger statement is missing the BEFORE/AFTER/INSTEAD OF clause.
    *Action:   Specify either BEFORE, AFTER or INSTEAD OF.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • After new I tunes download air express gives error message when try to play

    The problem is not with the airport express which works fine with i tunes on other computers on the network I uploaded i tunes a second time. No improvement. Also shut off the firewall. Also did latest firmware on airport express and reconnected. Still get the same error message. Internet with this computer using the airport is fine

    The above should read when try to play connected stereo

  • HT201699 My Ipad 2 recognizes my MTNL Micro sim and connects me to 3g network easily. I put the same sim in the latest ipad 3, it always gives error as "sim failure'. I did all the work such as putting correct APN, restarting the ipad etc. Still why this

    I do have this problem with new Ipad3.
    I used Ipad 2 3g with mtnl,Mumbai as carrier. The sim I used have not given me any problem as my Ipad immediately recognized and connected me to internet.
    Recently i purchased I pad 3 3G. I have inserted the above micro sim to this ipad. It always gave this message as " Invalid Sim".I have the the following to correct the problem
    Put the correct APN under cellular data.There is no need of user name or pass word
    Restarted my I pad after putting the APN
    Taken out the sim from the tray and reinserted it later.
    Checked whether I got the latest carrier version
    Turned off wifi
    Switched on and off cellular data
    I know that the sim is not locked because the same sim is working in my telephone as well as ipad2
    Now the SOS to my community members please....

    Oh friend. Now I am totally disappointed with this big purchase. My connectivity is now limited with wifi only.(till my operator starts 4G service).
    Anyway manyy thanks for attending my doubts....

  • HT4436 my massage alway give error with the server try again later help

    someone know how strigh forward reset massage and fix error with the server????
    help

    See http://support.apple.com/kb/TS3970?viewlocale=en_US&locale=en_US - maybe it can help solve your problem.
    Clinton

Maybe you are looking for

  • How can we tell the progress of download of Lion?

    I purchased the app for Lion operating system, but I see no progress bar, etc. The tab says "installing" and I'm assuming it is, but I am wondering how long it will take and any other information as to what to do next. Any clarification? Thanks.

  • How to repeet same segment in IDOC for diffrent inputs in source

    Hi Experts, I have a requirement. My secnario is file to IDOC. I have three fields in each record of source file like below. Emp1, Name1, Sal1; Emp2, Name2, Sal2; Emp3, Name3, Sal3; My requirement is, there is one segment (E1EDK14) in IDoc With Cardi

  • Can't See Facebook "Log In" Button

    When using Safri to access Facebook there is not "Log In" button displayed and therefore I can't log in.  When I use Chrome everything is normal.  I have cleared my cache and rebooted but nothing seems to help.  Any thoughts?

  • How to display, 2 vo's attributes in single table.. they are connected VL

    Hi to all oaf gurus....!! i have a search page... with n number of attributes. When the user enter a attribute... search is done in VO by using dynamic where clause in voimpl class.Now the problem is that there is one attribute that cannot be retriev

  • Missing Statement.

    I have trouble declaring all the methods in main function. Can you help me with the following code? Thanks. private static int readIntegerFromUser(){ return 0; private static boolean isPrime(int num){ return false; private static int countPrimes(int