How do i specify the filename for a binary file generated by a JSP?

I am writing a report generator that has the ability to generate Excel files. The user clicks on a link (exporter.jsp), the page's content-type has been set to "application/vnd.ms-excel" which naturally prompts the user to either save to a file or open directly in Excel.
It works fine, but requires the user to manually rename the generated file from "exporter.jsp" to "whatever.xls". Furthermore, Firefox will not let you rename the file in save dialog box, it just automatically saves the file as "exporter.jsp", you must rename it from the file browser.
How do specify the output file name from within JSP?
Btw, right clicking and selecting "save link as" allows for specifying the file name, but the file that is created is empty.
Thanks

You need to set the content-disposition header as well as the content-type.
here is one article on the subject
res.setContentType("application/vnd.ms-excel");
res.setHeader("Content-Disposition", "attachment; filename=" + filename);

Similar Messages

  • How can we specify the Mailbox for Notes?

    In Mail.app, how can we specify the Mailbox for Notes (where the new notes will be resided)? It is now 'On My Mac'. I wish to change to my IMAP Mailbox so it sync with my iPhone by just checking email (not by syncing on iTunes).
    Thanks in advance.
    Message was edited by: Ekapon

    You could use the DecimalFormat or NumberFormat to do the job.
    double number 1234.567;
    DecimalForamt df = new DecimalFormat("###.##");
    String s = df.format(number);or
    double number 1234.567;
    NumberFormat nf = NumberFormat.getNumberInstance();
    nf.setMaximumFractionDigits(2);
    /* if needed.
       nf.setMaximumIntegerDigits(value);
       nf.setMinimumFractionDigits(value);
       nf.setMinimumIntegerDigits(value); */
    String s = nf.format(number);I didn't test the codes but they should work. For more information, please consult the documentations.

  • Specifying the filename for outbound FTP transport in OSB

    I want an OSB based service that will send via FTP a file with a specific name to a remote ftp location.
    It appears OSB can't do this because the FTP transport on a business service only allows you to specify the prefix and suffix and then generates a big long file name for the midlle parts.
    Does someone know how to override this and specify the name that you want teh remote file name to be called?

    mdsrobbins wrote:
    Your response was helpful but being new to OSB I'm still not quite there because I want to pass a "variable" to the file name. Now given I want to ftp a CSV file I've specified a proxy messaging service in an MFL format behind a jms queue. The business service underlying this is the ftp service again using the MFL format. This all works but in the message flow I for the proxy I can't seem to get access to a user defined property which contains the filename which I could then pull out and stuff into the "filename" header as suggested above.
    Doe anyone have any ideas how I can get access to a filename property from a JMS message?From what i understand
    JMSQ--- JMS PRoxy (MFL)----Pipeline ----->BS (MFL/FTP)---FTP server
    So you would like to set the filename that is contained the JMS message custom headers?. While creating your JMS Proxy you have to follow these steps
    1) While creating JMS Proxy in Transport Configuration page select Get All Headers =Yes
    2) If file name is set as user defined property in JMS message then use $Header in you pipeline/message flow. This variable will hold your user defined properties. If the user defined property is part of JMS message then use $body.
    thanks
    Manoj

  • How to reliably check the resolution for a pdf file?

    Should I use preflight to reliably check the resolution for a pdf file?  I have posted my frustrations on http://forums.adobe.com/thread/978098

    You can create your own preflight tool to check for the dpi of embedded images.

  • How do I change the thumbnail for a video file?

    Can I change the thumbnail for a video file (ex. .mov) in Bridge CS4?

    Can I change the thumbnail for a video file (ex. .mov) in Bridge CS4?
    Not to my knowledge. It seems it takes a snapshot from about the 10th second of the movie and creates a thumbnail for it. On a Mac the finder thumbnail shows the first frame of a movie, both don't seem to be able in getting customized.
    It will be down to a good naming convention I'm afraid. Not having CS4 installed anymore but on Bridge CS6 .mov files play on an reasonable sized scale in good quality in the preview window, maybe that will help you?

  • How do I specify the location of my aperture file?

    I don't have space on the Macbook for all my music and aperture library so i have the photos on my MacPRO. Now i want to sync some photos to my ipod and appleTV but i cannot find a way to specify where the aperture file is.
    I can find a way to point to the aperture folder, but not the file.
    Anybody got any ideas please?
    Cheers John

    Silly me Just double click the aperture library and hey-presto!!

  • How do i make the background for a BMP file, transparent?

    I've been working on an icon for design reasons, and when i save the file as a .BMP, the background appears white. The file i work in has no background and it transparent, except for the icon of course. The dimensions of the icon are 32px by 32px. I can't upload the bitmap file onto this topic, apologies if that hinders anything,

    Windows Bitmap – Wikipedia
    32 bit-per-pixel BMP (mode ARGB )has a leading byte, which is used by Photoshop
    as alpha-channel for variable transparency. That's not a part of the BMP specifications.
    It should be avoided, IMHO.
    The reason for the introduction years ago has been the faster access by 32 bit
    registers (opposed to 24 bpp).
    Best regards --Gernot Hoffmann

  • How to preset the filename for an exported file?

    Post Author: yekken83
    CA Forum: General
    Hi all,
    Generally, the exported file name will defaulted to report name. However, anyone know that can i change the exported file name to another specific file name which different as my report name? The exported file naming as following:- Let said i would like to export my report (dailyreport.rpt) into excel file and the exported file name as below:- dailyreport_<Report_Run_Date>.xls **<Report_Run_Date> will be a field which is retrieve from my stored procedure.

    Post Author: pvierheilig
    CA Forum: General
    Hello,
    If you've not already solved this, let me ask a couple q's:
    What tool are you running this report through for the export (it sounds like you're wanting to automate the process)?
    Is it Business Object XI or Crystal Enterprise or simply manually exporting it using the CR designer program or...?

  • How can I change the appearance of html report file generated from Teststand to that I change the orientation of the data in the tables?

    For instance, I'd like to have the measurement results, limits, and status all on one line in a table.
    I am running Teststand 2.0 on Windows 2000.

    Hello Joel_IEI,
    You can modify each report entry as it is being generated by doing the following steps:
    1) In the TestStand Sequence Editor's Report Options, change the Report Generator to "Sequence".
    2) In your sequence file, override the ModifyReportEntry callback. In this callback, you can modify or even replace ENTIRELY the default report information TestStand plans to append to the report. You can use Statement steps to modify the contents of Parameters.ReportEntry (the TestStand variable that you will use to do this), or replace the contents entirely!
    You can look at the code example Adding Extra Results to a Report Using the Modi
    fyReportEntry Callback Sequence for more information.
    David Mc.
    National Instruments

  • In LV, using TS API, how do I specify the VI module for a Pass/Fail step?

    I am writing a LabView VI which will let a user write a TestStand sequence. Each step in the seq is the same type, a Pass/Fail test. I need to specify for each step the LabView VI module location, and an input buffer. I am having difficulty finding out how to specify the module for the step using the TestStand API in LabView. How to do this????

    Hi Drew,
    I think Dennis might have come at this from the wrong angle.
    Have a look at the example that ships with TestStand under
    \Examples\SequenceBuilderTool\LabVIEW
    This might give some clues, but I'd suggest posting this question over to the TestStand discussion Forum as suggested by Dennis.
    There'll be a few more people there who can help a bit more in-depth
    My personal suggestion is to create a custom step type that calls the .vi's and then you can create the steps in a new sequence file using your tool easily. This could be cumbersome for you if you already have a lot of steps setup.
    Better then to create a resource to get the steps out of to clone them by creating a sequence file which is full of your steps. When you have a handl
    e to a cloned step, you can change properties about it in memory, before putting it into the sequence (i.e. change it's name and stuff)
    Otherwise you need to get the type and create a new step of this type.
    If all you're stugling with is the module to call, then for the step you have a handle to, change the
    you can either change the "Step.TS.SData.ViPath" as a string (TestStand set property value String with a reference to the sequence_context) or if you wanted to bring up the specify module dialog, if you have a handle to the step itself, call the method SpecifyModule.
    Hope that helps
    Sacha.
    // it takes almost no time to rate an answer

  • How can I specify the default tab in a CHM Output?

    My company uses CHM-based help for some of its products. We build the CHM files from RoboHelp 9, and while these CHM files don't really have a full Index attached to them, the Index tab shows up in the output anyway. Unfortunately, we are suddenly seeing that when the CHM file is launched from our program, the Index tab is displayed by default. We'd rather have the Contents tab be the default look, especially considering that the Index does not exist.
    I have poked around into how you can specify a default tab for a CHM file, and the only information I have found suggests that using a CHM file creates a file (HH.dat) that specifies which tab should be displayed on a user-by-user basis, and that the last tab displayed when you close the CHM should be the first one displayed when you re-open it. While this is true if you open the CHM independent from the product, when you launch it from our program, it's all Index, all the time.
    So, my question is: How can I specify the default tab for a CHM file? Or, failing that, how can I excise the Index tab from my CHM output.

    Hi there
    This will be something up to your application developer to resolve. When s/he issues the call to open the CHM, there are parameters that may be used to always open with the desired tab "in front".
    Point your developer to the link below and advise that s/he is most likely interested in the section titled: Programming Tips.
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • How do I specify the JRE i wish to use to Run an Application.

    Hi Everyone;
    Please bear with me if you read this before.
    I have installed java 1.3.1 and java 1.4.1 in that order.
    The JRE used by default is java 1.4.1
    How do I specify the JRE I wish to use to Run an Application from a command prompt.
    Example:
    Java -something org.jboss.Main
    help ??
    Stephen

    I was a lil embarrassed. I told my supervisor that the installation of java overwrites the JRE and that's that.
    My supervisor took 10 minutes and went through it and found java.exe in the System32 file.
    The java.exe file is found in guess where "C:/WINNT/System32/" folder how nice. C:/WINNT/System32/ is in the path. Not only that it's the first entry in the path. So when I execute java it is not using java.exe any one of the java files that I got from the java website.
    So I don't have any control over the version.
    Oh well;
    That's life. That's 1 for my supervisor.
    Stephen

  • Hi, how can i break the value for a row and column once i have converted the image to the array?????​??

    Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
    At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've  tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
    Please help me!
    For your information, I'm using LABView 7.0.

    Hi,
    Thanks for your reply.Sorry for the confusion.
    I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
    Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
    I hope that I have made the problem clear. Sorry if it is still confusing.
    Hope you can help me. Thank you!!!!
    Attachments:
    arrayrowncolumn2.JPG ‏64 KB

  • How do I specify different emails for a form to send to based on different selections?

    How do I specify different emails for a form to send to based on different selections?
    Creating a form that can be sent to an email address is simple enoug but my problem I can't figure out.  There is a drop down menu on the form and based on what the user selects the form will be sent to 1 of 3 groups of email addresses.  How can I specify which group of email addresses belong to a particular dropdown menu selection?

    You can populate the drop down with a dataprovider that has the dropdown field and the emailgroup field.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.events.FlexEvent;
          import mx.collections.ArrayCollection;
          [Bindable] private var dataAC:ArrayCollection = new ArrayCollection([
            {label: "one", email: "[email protected]"},
            {label: "two", email: "[email protected]"},
            {label: "three", email: "[email protected]"},
          private function changeFunc(evt:FlexEvent):void{
            txt.text = evt.currentTarget.selectedItem.email;
        ]]>
      </mx:Script>
      <mx:ComboBox id="cmbx" dataProvider="{dataAC}" valueCommit="changeFunc(event)"
        labelField="label" creationComplete="cmbx.selectedIndex=0"/>
      <mx:Text id="txt"/>
    </mx:Application>
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • How do i show the filename.type instead of the entire file path?

    How do i show the filename.type instead of the entire file path?
    I want it to show "ProgramSetup.exe" instead of "C:/Program Files/Oracle/JavaFX/ProgramSetup.exe"
    I have created a JavaFX program with the help of my manager
    below are the code
                   File file = fileChooser.showOpenDialog(Admin.mainStage);
                   if (file != null) {
                        textFiles.setText(file.getAbsolutePath());
                        String absolutePath = file.getAbsolutePath();
                        //String fileName = new File(absolutePath).getName();the reason i put the last line as // because it has error on that line....
    if i remove the last line, it will display but with the full path....
    i search through google and the guide on many forums aren't clear to me.....some said there are 2 ways but i tried and it is not working, atleast for me...maybe i left out something or what....can anyone help me on this?

    You don’t need the absolutePath:
    File file = fileChooser.showOpenDialog(Admin.mainStage);
                   if (file != null) {
                        textFiles.setText(file.getName());
                               }

Maybe you are looking for

  • How to create an animated gif with CS4?

    Trying to create an animated gif from 8 images using FW CS4.  Can't find "how to" via online FW help.  Have done it before with version 8 -- followed the in-house Help db but CS4 doesn't have in-house db.  I found a tutorial: http://www.entheosweb.co

  • Family Sharing and Itunes ( on WIndows )

    I have Itunes on my windows computer. My wife has an Ipad, Ipad Air,  and Iphone 5 with her own account, we got my son a Ipod Touch, I was able to do the Family Sharing, but had to set it up on my Wifes account, since I do not have my Itunes linked t

  • How to provide link for the topics of Webhelp in the Context Sensitive Help in RH10 ?

    I am using Robohelp 10 and currently working on Context Sensitive Help in which there is a need to create certain links for the topics that are present in Webhelp. My area of concern is that we can't use map id's since CS Help and Webhelp had already

  • I have been billed by I Tunes and I did not purchase any

    I did not purchased lately in Itunes and I was billed. What to do?

  • EDQ Test planning and recording

    Hi, I'm working on a data deduplication and matching project using EDQ. We need to document our unit test plans and evidence. EDQ allows easy manual checking of dataflows but I don't want to waste time taking screen grabs and producing unwieldy docum