Path and file name problem when I want to download files from html

Hi all,
I want to write a small program to allow users download files from jsp file
but the following files don't work .
<%@ page language="java" import="java.net.*,java.io.*"%>
<%@ page import ="java.util.*"%>
<%
try
String SContent = request.getParameter("click");
String SDocName = "temp.doc"; //  out put file File Name
ServletOutputStream stream= response.getOutputStream(); // Getting ServletOutputStream
response.setContentType("application/msword"); // Setting content type
response.setHeader("Content-disposition","attachment;filename=\"" +SDocName+"\""); // To pop dialog box
BufferedInputStream in = new BufferedInputStream(new FileInputStream(SContent));
int c;
while ((c = in.read()) != -1){
           stream.write(c);
in.close();
stream.flush();
catch(final IOException e)
System.out.println ( "IOException." );
catch(Exception e1)
System.out.println ( "Exception." );
%>I am so confuse, what is the path and file name I sould give ? for example my click should equal to http://******/Test/display.jsp?click=00-1

Hi all,
I got error at
java.lang.IllegalStateException: getOutputStream() has already been called for this response
     org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:599)
if I want ot download file from html file.
String SContent = request.getParameter("click");
if I hard code like follow it work fine.
String SContent ="C:/Project Coding.doc";
what mistake I make.
Thank you!

Similar Messages

  • Problems when I want to download files or programs

    Hi everyone,
    I have been trying to download files from the internet and it is impossible. For example, today I wanted to download the weather application channel for my mac and I could not it. My mac just stay like processing and that it. So I took another computer in this case with windows and I did it in 1 minute, then I used a memory flash and I installed in my mac. I used to do things like this when I want to download something. Somebody has any idea what could be the problem? I was think the velocity of the internet, but I tried with connecting with my university's internet and happens the same.
    Thank you.

    Koi24 wrote:
    If I do this, something is going to happen with my mac, I mean, I have to reinstall of my programs and things like that.
    Thank you
    That is not true if you exactly follow these directions; Boot from your install disc & run Repair Disk from the utility menu. To use the Install Mac OS X disc, insert the disc, and restart your computer while holding down the C key as it starts up.
    Select your language.
    Once on the desktop, select Utility in the menu bar.
    Select Disk Utility.
    Select the disk or volume in the list of disks and volumes, and then click First Aid.
    Click Repair Disk.
    Restart your computer when done.
    Repair permissions after you reach the desktop-http://docs.info.apple.com/article.html?artnum=25751
    My mac just stay like processing and that it.
    Can you please be more specific? Do you get any error messages and if so, what does it say? Are you getting the colorful wheel (beach ball)?
    How much hard drive space do you have?

  • I have some problem when I want to download app in iTunes some security question ask me about my visa when I right my visa number I got an errors and on top of the page told me go to iTunes support I do these things and now what should I do

    I have some problem when I want to download app in iTunes some security question ask me about my visa when I right my visa number I got an errors and on top of the page told me go to iTunes support I do these things and now what should I do

    Most of the people on these forums, including myself, are fellow users - you're not talking to iTunes Support here.
    You can contact iTunes Support via this link : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • When I want to download -anything- from safari, the page just closes 0.0 please HELP!

    please, I need help, when I want to download something with safari, the page just disappears!! 0.0 HEEEELP!!

    Launch the Console application by entering the first few letters of its name into a Spotlight search, and look under "User Diagnostic Reports" for crash logs related to Safari. Select the most recent one and post the contents -- the text, please, not a screenshot.

  • Hello, i have a problem when i want to download an app it asks for my secret question and answer but i forgot it how can i solve this problem please help?

    Hello today I wanted to download an app on my ipod touch infact its a game and as usual it asked for my appl id and password so I entered them but next it asked me to enter my passowrd againg and answer the secret question I submited when I first got my Ipod touch, the problem is i cant remember the question neither the answer,so is there a way I can find out what my secret question is and the answer of course I would appreciate youre help.
    Fouad

    Only you and Apple know your secret question.  See if changing the password via email will allow access to your account.. Then you can chnag yur secret question. See:
    http://support.apple.com/kb/HE36

  • File name changes when I click on another file.

    Regardless of which application I'm in (CS2, Quark etc.... When I go to save a file, if I accidentally click on a grayed out file while I'm navigating to the folder where I want the file to be saved, the file I'm trying to save assumes the grayed out files name. I assumed this was a bug with OSX and Apple would fix it but now that we're up to 10.4.5 I'm dumbfounded.

    That's not a bug, it's a feature.
    Seriously, it's intentional. It could be that they made that change at the request of many Windows switchers, or it just came along with the BSD version of Unix that OS X is built on top of. Either way, it's part of OS X. You need to be careful not to click on a file name in the save dialogue.
    For long time users os OS 9 and earlier, this is a headache, as you never had to watch for that before. But once you get used to it, it's actually very handy at times.

  • After downloading firefox installation file, I cant install firefox on my PC running on windows 7, and internet explore 9( when i want to run file, i recive error, Extraction Failed, File is corrupt, ,

    but my security software, microsoft security essentials , find nothing wrong whit the file, i have allsow chance the settings off my firewall , to accept the firefox file, but nothing chances?
    Can you please help to find the problem

    This can be caused by anti-virus software/ real time scanners. Please try to disable your anti-virus software real time scanner and try again. Do not forget to enable it after the download is complete!'
    See http://kb.mozillazine.org/Unable_to_save_or_download_files (Disable virus scanning in Firefox preferences - Windows)

  • HI I just bought a house computer and for some reoson when I want to download Flash Player it gets stuck on the 50% I do everything it instructs me to, but it gets stuck on the 50% please help????

    It does not let me download Adobe Flash Player. It gets stuck on the 50% an dI do everything that it instructs me to do and still it gets stuck on the 50% . Pleae hepl me uggh.... Its a home computer Mac Mini 2.5 ????

    Hello,
    Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive & clear caches.)
    Reboot & try, any change?

  • I didn't set any password during setup of Lion, but now when I want to download stuff from safari, it asks me for password? plz help

    I bought a new macbook air pre loaded with Lion. while setting up the system, I just input the user name, and didn't set any password.
    But now when I wanna download stuff off safari, it asks me for password. The user name appears (the same one which I set) but it keeps on asking me the password which I never set. Can some one please help me. Thanks!

    I did it like that, but for the purpose of not having to type my password every time since I'm installing a lot of programs, and yes, it asks for the password, but do not type anything and just click "ok" or "install", since you haven't set a password it should let you go through. I guess it asks for the "password" just to let you know it will install something, but just click ok.
    I will set up a password once i have install everything in System Preferences/Users & Groups
    Hope it helps...

  • I have a problem when i wished to download mavericks., i have a problem when i wished to download mavericks.

    i have a problem when i try to download mavericks from the app store.
    it asks me to sign in to [email protected] a gmail address that i have never heard of.
    this seem too strange to me!
    i have tried to contact apple support but after a total of half an hour waiting they are just too busy
    anyone know a way i can download mavericks not from the app store?

    You installed a hacked app, originally from the Mac App Store. It contains the receipt for a different app, downloaded using an account that you don't control. You need to identify and remove the hacked app.
    Important: The app you need to remove is not necessarily the one named in the App Store notice. For example, if the App Store says you need to update "Twitter," the hacked app may be "Angry Birds" or something else entirely. Don't make any assumptions about which app you're looking for. To find it, you have to carry out a systematic search.
    Triple-click anywhere in the line of text below on this page to select it:
    kMDItemAppStoreHasReceipt=1
    Copy the selected text to the Clipboard (command-C).
    In the Finder, press the key combination command-F to open a search window, or select
    File ▹ Find
    from the menu bar. In the search window, select
    Search: This Mac
    from the row of tokens below the toolbar. Below that is a popup menu initially showing Kind. From that menu, select  Other...
    A sheet will drop down. In that sheet, select Raw Query and click OK or press return.
    Now there will be a text box to the right of popup menu. Click in that box and paste (command-V).
    The search window will show all the App Store products you've installed. Compare those search results with the list of your purchases from the App Store. To see the complete list, you may need to unhide hidden purchases. If any apps were download from the App Store using other Apple ID accounts that you control, sign in to the store under each of those ID's and check the purchases.
    At least one of the items listed in the search window is not among your purchases in the App Store. Move each such item to the Trash. You may be prompted for your administrator password. Empty the Trash.
    Log out and log back in. Test.

  • When i want to download the new version of iPhoto, i get this message : You can not update this software since you do not have the main version. What should i do ?

    HI,
    I got this problem : when i want to download the new version of iPhoto, i get this message : You can not update this software since you do not have the main version. What should i do ?
    IPhoto was already on my MacBook Pro when i bought it.
    Thank you for your help
    Thierry

    Welcome to Apple Support Communities
    Open App Store > Purchases, and see if iPhoto app is listed. If not, unhide it > http://support.apple.com/kb/HT4928 Apart from that, check that iPhoto is in Applications folder. If not, put it in this folder.
    If nothing works, remove iPhoto, open App Store > Purchases, and install iPhoto free of charge

  • I see a white box on the app store when I wanted to download an app

    I wanted to download a specific app. When I wanted to download it from the app store I just see a plain white square in the middle and the app preview does not appear. Please help :(: Product: iPad. Mini

    Do you see a blank square when you try to download a specific app, or is it the same when you try to download anything? If it's for a specific app, could you specify the app?
    If you can't download anything at all...well, let's cross that bridge later.

  • Specify the output file path and print name when printing pages

    hi,
    how can i Specify the output pdf file path and print name when i am using the function PrintPagesSilent from AcroAVDoc Object.
    My Code :-
    Acrobat.AcroAVDoc doc = new Acrobat.AcroAVDoc();doc.Open(path,
    "temp");

    Dear Irosenth,
    i try with different format (doc, docx,  xls, jpg, bmp and txt) and it working successfully, but it give an random name for the file which saved in default folder for Adobe PDF print.
    you can use the following function:
    private void PrintPDF(string[] inputfilepath){
    foreach (string path in inputfilepath){
    Acrobat.
    AcroAVDoc doc = new Acrobat.AcroAVDoc();doc.Open(path,
    "temp"); 
    Boolean v = doc.PrintPagesSilent(0, ((Acrobat.AcroPDDoc)(doc.GetPDDoc())).GetNumPages() - 1, 0, 0, 1);doc.Close(1);
    and calling it by the following code:
    PrintPDF(System.IO.Directory.GetFiles("c:\\t\\printjob"));
    copy all files that you want to convert in side the mentioned path and run it program, then check the defualt print path for Adobe PDF printer.
    test it and reply me. thanks again

  • Hi ... i want to ask why i can't download (whatsapp,skype,faceboo)on my iphone ???? and why always appear message my password error when i want doing download ??? if my password error i can't sign in here !!!! what's the problem???

    hi ... i want to ask why i can't download (whatsapp,skype,faceboo)on my iphone ???? and why always appear message my password error when i want doing download ??? if my password error i can't sign in here !!!! what's the problem???

    Errors 3000-3999 (3004, 3013, 3014, 3018, 3164, 3194, and so on): Error codes in the 3000 range generally mean that iTunes cannot contact the update server (gs.apple.com) on ports 80 or 443.
    Update to the latest version of iTunes.
    Verify the computer's date and time are accurate.
    Check that your security or firewall software is not interfering with ports 80 or 443, or with the server gs.apple.com.
    Follow Troubleshooting security software. Often, uninstalling third-party security software will resolve these errors.
    An entry in your hosts file may be redirecting requests to gs.apple.com (see "Unable to contact the iOS software update server gs.apple.com" above).
    Internet proxy settings can cause this issue. If you are using a proxy, try without using one.
    Test restoring while connected to a known-good network.

  • How to retrieve the path and the name of the destination file in a link annotation

    Hi,
    In C++:
    How to retrieve the path and the name of the destination file in a link annotation and a Launch action.
    Sample of my code:
    //Determine if the annotation is a Link annotation
    if (PDAnnotGetSubtype(annot) == ASAtomFromString("Link")) {
    //Determine if the action is a Launch action
    if (PDActionGetSubtype(action) == ASAtomFromString("Launch")) {
    // What is the method ?
    Regards
    David G

    In general, get the annotation as a Cos object and examine it, in
    accordance with the PDF Reference.
    Aandi Inston

Maybe you are looking for

  • Duplicate payment

    Hi, I have a following case -- There are two duplicate payment lots created -  X and Y . Then all items in Y lot are reversed. But in the FBL3N , duplicate entries can be seen. Is there any process missing ? Thanks. Nachiket

  • I have a problem with Photoshop Elements 11 Organizer

    When I load images from my camera or a folder from e:\ drive into an existing or new e:\drive folder, Organizer catalogues them in an i:\ drive. I don't actually have an i:\ drive and when the images are "missing". Organizer starts a seach to try and

  • Test.doc to test.pdf using jakarta tomcat POI

    Hi I need to convert my test.doc file in to test.pdf.I found a API jakarta tomcat POI project handling file systems 1) is it possible to do that?(test.doc convert to test.pdf) 2) do i have to use POIFS API or HSSF API HPSF API?which API 3) do i have

  • What is the use of checking Attribute Only in IO?

    Hi, Can some one explain what is the use of checking Attribute Only in IO? I couldn't find the right answer in the forums.  Thanks, Sam

  • What is AdbeRdr60_enu_full_exe in other languages?

    Hi can someone help me out? I've an urgent translation to make, it's about Adobe Reader 6.0 and installing that version. In the steps to follow the following text appears: Double click AdbeRdr60_enu_full.exe . I would like to know how I should `trans