How to get Open/Save Dialogue box

Hi,
I need to get open/save dialogue box while downloading a file (from JSP).
One way which I am currently using is on click of the button pass control to servlet and in servlet using the following code:
/**.....Some Code */
response.setContentType("application/csv");
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
/**.....Some Code */But I am wondering is there any way I can do the same without passing the control to Servlet? On clicking the button in JSP, is there is any possibilty to get the Open/Save dialogue box directly.
Thanks
Arun

without passing the control to Servlet?Why?
In HTTP you can send the response only once.The application where i have this requirement is an old one. In the application, I have there are some screens, whose control never goes to Servlet.
TO be more precise, 2 pages one HTML and another JSP. And the file to be downloaded is created when JSP is called from HTML page. And there is no interaction with Servlet. The JSP inturn calls a method in Java file (which is not a Servlet) and gets all the details including the file to be downloaded.
I have used window.open() to download the file(in JSP) in order to have Open/Save dialogue box.
But the approach is working fine in Windows XP systems but not in Windows2000. In Win00 machines it is directly opening the file in popup without giving the user any option for Open/Save.
Please let me know your suggestion on this.
Thanks

Similar Messages

  • Open save dialogue box wehn run servlet program

    hi,
    i m having one servlet file(Write_File.java).. in this prog i retrive some data form one table and write into one file(c:\\write.be).. its automatically stored tat file in server machine.. now what my issue is when i run Write_File.java, it sholud have to shows save dialogue box..
    file name : Write_File.java
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class Write_File extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
              PrintWriter out = response.getWriter();
              //boolean header = true;
    FileOutputStream fos = new FileOutputStream("c:\\write.be");
              try
                   Class.forName("com.mysql.jdbc.Driver");
                   Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/cha_db","root","user");
                   Statement stat = con.createStatement();
                   ResultSet rs = stat.executeQuery("Select * from acc_ledger");
                   ResultSetMetaData rs_meta = rs.getMetaData();
                        out.println(rs_meta.getColumnName(1)+"\t"+rs_meta.getColumnName(2));
                        fos.write((rs_meta.getColumnName(1)+"\t\t"+rs_meta.getColumnName(2)+"\r\n").getBytes());
                        fos.write(("--------------\t\t--------------\r\n").getBytes());
                   while(rs.next())
                        fos.write((rs.getString(2)+"\t\t"+rs.getString(3)+"\r\n").getBytes());
                   fos.write(("========\t\t========\r\n").getBytes());               
              catch(Exception e)
                   out.println(e);
              fos.flush();
              fos.close();
    pls solve this problem
    by
    senthilkumar
    thnks in advance
    Edited by: vishruta on Nov 16, 2007 3:02 AM

    without passing the control to Servlet?Why?
    In HTTP you can send the response only once.The application where i have this requirement is an old one. In the application, I have there are some screens, whose control never goes to Servlet.
    TO be more precise, 2 pages one HTML and another JSP. And the file to be downloaded is created when JSP is called from HTML page. And there is no interaction with Servlet. The JSP inturn calls a method in Java file (which is not a Servlet) and gets all the details including the file to be downloaded.
    I have used window.open() to download the file(in JSP) in order to have Open/Save dialogue box.
    But the approach is working fine in Windows XP systems but not in Windows2000. In Win00 machines it is directly opening the file in popup without giving the user any option for Open/Save.
    Please let me know your suggestion on this.
    Thanks

  • How  to get  the  Save  dialouge box  in   SAP Business One

    Hi,
    How  to get the  Save dialouge box in    Button  click  event  in  SAP Business One.
    Thanks,
    Y.

    Hello,
    You would like to display an SaveFileDialog box?
    may follow this thread, and you can find a sourcecode in vb.net and c# inside (for open dialog, but it is the similar...)
    Regards
    János

  • How to skip(do not wnat to get display) save dialogue box for file download

    I am having servlet for downlading a file from server. When I call this servelt I am able to get the file from server but I get a save dialog box which I do not want. I want that this file should be stored at a specific location given by me in a servlet.
    So haoe I can avoid that save dialog box and where I should specify the specific location?
    Thanks in advance
    package com.txcs.sms.server.servlet;
    import java.io.*;
    import java.util.zip.GZIPOutputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class DownloadServlet extends HttpServlet
        public DownloadServlet()
            separator = "/";
            root = ".";
        public void init(ServletConfig servletconfig)
            throws ServletException
            super.init(servletconfig);
            context = servletconfig.getServletContext();
            String s;
            if((s = getInitParameter("dir")) == null)
                s = root;
            separator = System.getProperty("file.separator");
            if(!s.endsWith(separator) && !s.endsWith("/"))
                s = s + separator;
            root = s;
        public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            doPost(httpservletrequest, httpservletresponse);
        public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            Object obj = null;
            String s = "";
            s = HttpUtils.getRequestURL(httpservletrequest).toString();
            int i;
            if((i = s.indexOf("?")) > 0)
                s = s.substring(0, i);
            String s1;
            if((s1 = httpservletrequest.getQueryString()) == null)
                s1 = "";
            else
                s1 = decode(s1);
            if(s1.length() == 0)
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter = httpservletresponse.getWriter();
                printwriter.println("<html>");
                printwriter.println("<br><br><br>Could not get file name ");
                printwriter.println("</html>");
                printwriter.flush();
                printwriter.close();
                return;
            if(s1.indexOf(".." + separator) >= 0 || s1.indexOf("../") >= 0)
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter1 = httpservletresponse.getWriter();
                printwriter1.println("<html>");
                printwriter1.println("<br><br><br>Could not use this file name by the security restrictions ");
                printwriter1.println("</html>");
                printwriter1.flush();
                printwriter1.close();
                return;
            File file = lookupFile(root + s1);
            if(file == null)
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter2 = httpservletresponse.getWriter();
                printwriter2.println("<html>");
                printwriter2.println("<br><br><br>Could not read file " + s1);
                printwriter2.println("</html>");
                printwriter2.flush();
                printwriter2.close();
                return;
            if(!file.exists() || !file.canRead())
                httpservletresponse.setContentType("text/html");
                PrintWriter printwriter3 = httpservletresponse.getWriter();
                printwriter3.println("<html><font face=\"Arial\">");
                printwriter3.println("<br><br><br>Could not read file " + s1);
                printwriter3.print("<br>Reasons are: ");
                if(!file.exists())
                    printwriter3.println("file does not exist");
                else
                    printwriter3.println("file is not readable at this moment");
                printwriter3.println("</font></html>");
                printwriter3.flush();
                printwriter3.close();
                return;
            String s2 = httpservletrequest.getHeader("Accept-Encoding");
            boolean flag = false;
            if(s2 != null && s2.indexOf("gzip") >= 0 && "true".equalsIgnoreCase(getInitParameter("gzip")))
                flag = true;
            if(flag)
                httpservletresponse.setHeader("Content-Encoding", "gzip");
                httpservletresponse.setHeader("Content-Disposition", "attachment;filename=\"" + s1 + "\"");
                javax.servlet.ServletOutputStream servletoutputstream = httpservletresponse.getOutputStream();
                GZIPOutputStream gzipoutputstream = new GZIPOutputStream(servletoutputstream);
                dumpFile(root + s1, gzipoutputstream);
                gzipoutputstream.close();
                servletoutputstream.close();
            } else
                httpservletresponse.setContentType("application/octet-stream");
                httpservletresponse.setHeader("Content-Disposition", "attachment;filename=\"" + s1 + "\"");
                javax.servlet.ServletOutputStream servletoutputstream1 = httpservletresponse.getOutputStream();
                dumpFile(root + s1, servletoutputstream1);
                servletoutputstream1.flush();
                servletoutputstream1.close();
        private String getFromQuery(String s, String s1)
            if(s == null)
                return "";
            int i = s.indexOf(s1);
            if(i < 0)
                return "";
            String s2 = s.substring(i + s1.length());
            if((i = s2.indexOf("&")) < 0)
                return s2;
            else
                return s2.substring(0, i);
        private void dumpFile(String s, OutputStream outputstream)
            String s1 = s;
            byte abyte0[] = new byte[4096];
            try
                BufferedInputStream bufferedinputstream = new BufferedInputStream(new FileInputStream(lookupFile(s1)));
                int i;
                while((i = bufferedinputstream.read(abyte0, 0, 4096)) != -1)
                    outputstream.write(abyte0, 0, i);
                bufferedinputstream.close();
            catch(Exception exception) { }
        private String decode(String s)
            StringBuffer stringbuffer = new StringBuffer(0);
            for(int i = 0; i < s.length(); i++)
                char c = s.charAt(i);
                if(c == '+')
                    stringbuffer.append(' ');
                else
                if(c == '%')
                    char c1 = '\0';
                    for(int j = 0; j < 2; j++)
                        c1 *= '\020';
                        c = s.charAt(++i);
                        if(c >= '0' && c <= '9')
                            c1 += c - 48;
                            continue;
                        if((c < 'A' || c > 'F') && (c < 'a' || c > 'f'))
                            break;
                        switch(c)
                        case 65: // 'A'
                        case 97: // 'a'
                            c1 += '\n';
                            break;
                        case 66: // 'B'
                        case 98: // 'b'
                            c1 += '\013';
                            break;
                        case 67: // 'C'
                        case 99: // 'c'
                            c1 += '\f';
                            break;
                        case 68: // 'D'
                        case 100: // 'd'
                            c1 += '\r';
                            break;
                        case 69: // 'E'
                        case 101: // 'e'
                            c1 += '\016';
                            break;
                        case 70: // 'F'
                        case 102: // 'f'
                            c1 += '\017';
                            break;
                    stringbuffer.append(c1);
                } else
                    stringbuffer.append(c);
            return stringbuffer.toString();
        public String getServletInfo()
            return "A DownloadServlet servlet ";
        private File lookupFile(String s)
            File file = new File(s);
            return file.isAbsolute() ? file : new File(context.getRealPath("/"), s);
        private static final String DIR = "dir";
        private static final String GZIP = "gzip";
        private ServletContext context;
        private String separator;
        private String root;
        private static final String VERSION = "ver. 1.6";
        private static final String CPR = "A DownloadServlet servlet ";
    }

    Can't be done, for obvious security reasons.
    Would you want someone downloading something into your windows\system directory when you navigate to their webpage?

  • Can't tab into file list when using column view in the open/save dialogue boxes

    Hi,
    When in Open/Save Dialog Boxes I can't use tab to select the file/folder list in Column View. Tab will only cycle through Save As, Tags, Search, and the Sidebar. In all the other views (Icon, List, Cover) I can tab into the file list. Is this a bug?
    I know that enabling Full Keyboard Access will make this work, but I'd rather not do that since it increases the number of buttons you must tab through to get to the file list.
    I'm using the latest version of Yosemite on a 2014 Macbook Air. Thanks.

    Hi,
    Did you found the solution to this? I'm also trying to do something like you , but I got stuck up in a very primitive stage than you. I'm not getting how I can make that File Download window to appear. Can you help me please.
    Thanks.

  • How to change open file dialogue box date format

    Hi - I can't find how to change the date format whenever I open any creative suite document - my system preferences are set to dd/mm/yy and every other application shows this date except for CS4 it shows mm/dd/yy. Can anyone help please. Much appreciated.

    Hi, I'm having the same problem with the date format - all Creative Suite 'open' menu items are showing US format mm/dd/yyyy rather than UK format dd/mm/yyyy... although everything else on my system is set for UK format and all other programs open properly. The strange thing is: I'm sure this has only just happened after years of using Creative Suite... I'm sure I would have noticed it before. I'm on CS3 so haven't had any recent updates that might have affected it.

  • Open and Save dialogue boxes are useless

    I have recently moved from Windows to Mac after being told I would never look back and I am already 'looking back' somewhat in terms of the OS. I work with photos and graphics and I'm on the move a lot so went for a Mac Book Pro Retina with SSD and I am not going to lie it is lightning quick and the display is beautiful. But when it comes to saving and opening workflow it does not work how I expected it would.
    It seems such a simple thing but you cannot rename files from within mac open and save dialogue boxes. I'm so used to right clicking on a PC to create a new folder, hit F2 or right click and hit rename to rename to what I want then save the file into that new folder. You can also directly edit the name of the files and folders from within the open save dialogue box. If you right click on a mac you can create a new folder but it defaults to the name 'untitled folder' and you then can't change it's name. It find it unbelievable that you can not do this on a MacOS! So unbelievable that I went into an Apple store and spoke with someone there. When I showed them the problem they weren't even aware of it and pointed out I should just use finder. But that is not convenient if if you want to rename a new folder to then have to come out of the open save relocate in finder and change from there.
    I know there is the new folder button down to the left hand side and you can rename the folder as soon as you create it using that but sometimes you may make a mistake and want to change it. Same with file names.
    Why can't you do this on a Mac? It's crazy. After searching about, I came across the Default Folder X app which appears to fix this issue which isn't really that cheap for something I consider should be 100% native in any OS.
    There are other issues that frustrate me from moving over from Windows to Mac (like the ability to snap windows to screen edges, Better Snap Tool fixed that for me at a much more reasonable price but still would have expected this to be native), which I know I will just have to get used to but this one really surprised me.
    Considering I was promised so much in terms of better efficiency with work flow and ease of use overall there is still a lot that's left to be desired.

    As Axeman1020 noted, the Mac OS is not Windows. Things are not going to be exactly the same. It's no different than if you went from Windows to Linux. So expect a month or so of getting used to a different OS. Once muscle memory gets used to the different keyboard commands, and just where things are in general and how they behave, it'll seem just as easy as Windows.
    To answer some of your statements or questions:
    It seems such a simple thing but you cannot rename files from within mac open and save dialogue boxes.
    Renaming items in the Open or Save dialogue boxes are not what those are for. I know Windows allows it, but why? That's a function for the desktop so you can't accidentally change a file or folder name in a dialogue box that has nothing to do with opening a file or saving one. If opening a file, that's all you're doing. If saving, only the name of the file you're saving can be modified. That's what those dialogue boxes are for - nothing else.
    Yes, you can give a file you're saving any name you like. You can even click on any name shown in the save dialogue box to give it that name if you want. You can also highlight the default name and change it.
    If you right click on a mac you can create a new folder but it defaults to the name 'untitled folder' and you then can't change it's name.
    Of course you can. Either highlight the folder and press Enter, or slowly click on the name twice. Either action will make the name editable.
    When I showed them the problem they weren't even aware of it and pointed out I should just use Finder. But that is not convenient if you want to rename a new folder to then have to come out of the open save relocate in finder and change from there.
    You're crossing over two different things. I believe you mean renaming a folder from the Save dialogue box. When you click the New Folder button, you have the opportunity to give the new folder any name you want before clicking Create.
    If you type the wrong name, then yes, you have to finish the save before you can rename the folder. So either be sure you type the name in correctly before clicking Create, or change the misspelling afterwards. You're not saving any time fixing a typo within the Open dialogue box. It will take the same amount of extra time to do it there as opposed to fixing it on the desktop after you complete the save.
    I know there is the new folder button down to the left hand side and you can rename the folder as soon as you create it using that but sometimes you may make a mistake and want to change it. Same with file names.
    You are again trying to force a Windows feature into an OS that is not Windows. The Mac does some things that I wish Windows could do, and visa versa. However, you can't force any OS to do something it simply isn't designed to do. Expecting it to change by sheer willpower is only going to drive you crazy. You need to let go of what you want the OS to do as opposed to what it will do.
    Considering I was promised so much in terms of better efficiency with work flow and ease of use overall there is still a lot that's left to be desired.
    I find the Mac OS to be incredibly efficient. This from a person who has used Windows for many more years overall than the Mac OS. Yes, it took time to get used to how the Mac OS behaved. But rather than fighting it (which is pointless), I simply took the time to learn how to use it as it's designed.

  • How to an on screen dialogue box?

    How to an on screen dialogue box?

    without passing the control to Servlet?Why?
    In HTTP you can send the response only once.The application where i have this requirement is an old one. In the application, I have there are some screens, whose control never goes to Servlet.
    TO be more precise, 2 pages one HTML and another JSP. And the file to be downloaded is created when JSP is called from HTML page. And there is no interaction with Servlet. The JSP inturn calls a method in Java file (which is not a Servlet) and gets all the details including the file to be downloaded.
    I have used window.open() to download the file(in JSP) in order to have Open/Save dialogue box.
    But the approach is working fine in Windows XP systems but not in Windows2000. In Win00 machines it is directly opening the file in popup without giving the user any option for Open/Save.
    Please let me know your suggestion on this.
    Thanks

  • After Downloading v8 I keep getting checking compatibilty dialogue box popping up, then Firfox opens two tabs, Meet Mozilla welcome page and my home page. How can I stop this?

    After Downloading v8 I keep getting checking compatibilty dialogue box popping up when I launch Firefox. Then Firfox opens two tabs, Meet Mozilla welcome page and my home page. How can I stop this?

    That is a legitimate Mozilla newsletter. As it says in the email:
    You're receiving this email because you subscribed to receive email newsletters and information from Mozilla. If you do not wish to receive these newsletters, please click the Unsubscribe link below.
    Unsubscribe https://www.mozilla.org/en-US/newsletter/existing/ad9febcf-65ac-41fd-810b-798945f448f3/
    Modify your preferences https://www.mozilla.org/en-US/newsletter/existing/ad9febcf-65ac-41fd-810b-798945f448f3/ "

  • Cannot get the past dialogue box to open in illustrator since upgrading to Yosemite. Click it but nothing happens. Also File Open works intermittently. Is this a finder preference issue?

    Cannot get the past dialogue box to open in illustrator since upgrading to Yosemite. Click it but nothing happens. Also File Open works intermittently. Is this a finder preference issue?

    one of those days --- it's the PLACE dialogue box

  • I keep getting the same dialogue box upon opening Firefox but don't know what to do about it

    I keep getting the same dialogue box upon opening Firefox but don't know what to do about it "Could not initialise the application's security component. The most probable cause is problems with files in your browser's profile directory. Please check that this directory has no read/write restrictions and your hard drive is not full or close to full. It is recommended that you exit the browser and fix the problem. If you continue to use this browser session, you might see incorrect browser behaviour when accessing security features." I have gone to tools - general tab - browse files - but it wont let me browse or set a place to staore files. Any ideas?

    Try the procedures shown in this link - https://support.mozilla.com/kb/Could+not+initialize+the+browser+security+component

  • Why can't I sort in Open/Save dialog boxes?

    Ever since I upgraded to ML, I found that I am unable to sort the listing in open/save dialog boxes. Currently the folder contents (List view) are all sorted by reverse Name. There are times I rather sort by Modification Date or Creation Date.
    The regular finder windows work as expected (click to sort, two clicks to reverse sort), but it seems this functionality have been removed from the Open/Save dialog boxes. I've searched for any tips/hints, but have been unable to find anything. Help.

    v3ktor.com wrote:
    Could not find the sorting function in the open dialogs before coming here. Really bad interaction design from Apple. It took me ages to figure it out. And if you sort it on "name" how do you switch A-Z or Z-A?
    You are not sorting, you are Arranging (ie grouping). In the Open file dialogs, you don't have an option to Sort.
    If you want to sort the items, set Arrangement to None and use the List View. Click the headers to sort. If you want to add more headers, right-click on the headers to select them.
    In the regular Finder Windows, the options when you click on that button without any modifiers is the Arrangement options. Arrangement groups items by those criteria. By Name is like Sort, but without an option to switch direction.
    If you press that button (or use the menu command in Finder) while holding down the Option (alt) key, you will get the sort options.  If you have an arrangement set, then the Sort option will sort within the groups. Some Arrangements have no sort option (like by Name) because it doesn't make any sense. If you just want to Sort, then set Arrangement to None and use the Sort option to sort.

  • Codesigned Projector and BuddyAPI (or other File Open/Save Dialogue)

    I noticed that with the Buddy Xtra, if baGetFilename call is made when an application is Codesigned, it will crash.
    Actually ANY attempt to use any file open/save dialogue attempt in a Codesigned application will not work.
    Has anybody found a work around for this?

    Hi,
    Did you found the solution to this? I'm also trying to do something like you , but I got stuck up in a very primitive stage than you. I'm not getting how I can make that File Download window to appear. Can you help me please.
    Thanks.

  • Open/Save Dialog Box SLOW

    My Mac has slowed down to an absolute crawl. I have reinstalled the OS, run Disk Warrior, Disk Utility, removed my preferences folder to see if something in there was actin' up, I've repaired the permissions, etc... Yet in any application (whether it's Photoshop CS 2, Safari, TextEdit, doesn't matter), if I hit "open" from within that application... no exaggeration... it can take anywhere between 45 seconds to a little over a minute for the dialog box to finally appear!
    The last thing I want to do is nuke my machine. I am so tired of that being the solution whenever something can't be fixed.
    Has anyone run into this? Does anyone have any ideas what to do to fix this problem without nuking the machine?
    (this hasn't been a problem at all until, maybe 3 months ago or so... and I've been running Tiger since it was released)

    Holy cow. I am in complete shock.
    ...got up this morning, saw the suggestion 'bout the iDisk, figured I'd give it a try...
    That was it!!! I've had a .mac account for years, have had my iDisk on my desktop for as long as I can remember. I wonder if something from software update somehow made my machine and the iDisk go "screwy" 'cause it started getting excruciatingly bad just a few months ago.
    Thank you, thank you!! My machine has received a gigantic speed boost across the board, and the open/save dialog boxes now appear instantly when I call upon them, all my apps quit instantly now too. This is amazing! [breathes huge sigh of relief]

  • Sort-by-type for column view in open/save dialog boxes?

    Hello all,
    I've done a fairly good search both on Google and in these forums and can't seem to find this question addressed. When I go to open or save something (in Preview, for example) I prefer to use Column View in the dialog box, since it is easy to see and navigate the folder structure. However, Column View always shows up sorted by name, even if I specified in Finder that the folder be sorted by type. Because of this, I have to scroll down and hunt for subfolders rather than having them conveniently listed at the top.
    My question is this: is there a way to get Column View to sort by type in the open/save dialog boxes? (The Command+J that works in regular Finder does nothing in these dialog boxes.)
    Thanks!

    No. Column view will only sort by name. If you wanted to put a space before each folder name, then they will sort to the top. Sorting by Kind will put folders above files, but it will also put anything else except files at the top. If there are only folders, however, that would put them first in the sort list.

Maybe you are looking for

  • HT204053 Set up Find my Mac with two iCloud accounts, same iTunes account?

    My wife and I use the same iTunes store account, but separate iCloud accounts.  When I try to add "Find my Mac" on her Macbook Air, it indicates that only my user ID can use that service.  How can I put her computer on her iCloud account, so that we

  • Cannot select multiple video clips at a time

    With the previous version, I could simply select all and import all my videos and pictures at once, in the order I copied them to my hard drive. Now, I have to "select entire clip" then, press letter E on every video clip, then, go back and add pictu

  • Ldb enhancement

    Hi experts, I have a few doubts about ldb in hr abap.can anyone explain me.... 1. how can we do enhancement for an ldb. 2. how can we make ldb selection screen field as mandatary. Thanks in advance Sudha Edited by: sudharaniG on Aug 23, 2011 9:49 AM

  • Wait time/need help

    Hi need help II used wait time function to wait 5 second before send command to my device , I put this function in while loop so I could display the waiting time until it is reach 5 seconds , it is work in the first run but when I run the VI for the

  • Frames Target Link problem

    I am working on a website and am having trouble with a link that will be clicked in one frame and opened in another frame. For some reason it isn't working. I don't want it to open a new window, I want it to open the page in the bottom frame. I only