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

Similar Messages

  • 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

  • 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.

  • 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.

  • 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]

  • Snow Leopard sidebar width in open/save dialog boxes

    I think I found the answer to the infuriating non adjustable sidebar width in the open/save dialog box.
    It requires finding the plist of every program you want to change (I know... annoying)
    Close the application if open. Open the plist in Property List Editor (which is the default anyway so just double click) and delete any line which begins NSNavPanelExpanded...
    Reopen the application and the sidebar now mirrors the settings in Finder (where the sidebar stays adjusted if you alt+click drag it).
    I haven't restarted yet so don't know if it will stick but I don't see why it shouldn't, and I don't know if it will reflect further finder changes to the sidebar width.

    In the case of Photoshop it looks like NSNavBrowserPreferedColumnContentWidth also needs to be deleted, or a new value entered.
    So it might be different for different programs

  • Open/save dialog boxes stuck at (too small) default size

    I've been having a relatively small issue with Mountain Lion that has become a big hassle. In past versions of OS X, whenever I'd resize an open/save dialog box in an application, it would be that size the next time I went to open/save. In Mountain Lion, however, those dialog boxes always default to the smallest possible size (which is too small to read a filename longer than a few characters). so I have to resize the dialog box — every time! I open and save a lot of files, so this gets pretty tedious. This doesn't seem to happen in apple programs, but it definitely does in the Office Suite and the Adobe Creative Suite, especially in CS4 Photoshop and Illustrator. Might be I can fix it by myself but I can't imagine where I may dig it.

    You might try looking here for the Adobe products:
    Adobe Help and Support
    Try Microsoft support for the Office Products:
    http://www.microsoft.com/mac

  • Check if file downloaded successfully , through Open Save dialog box

    hi,
    In the jsp I have a download link through which user can download a file which is located on the server . I have achieved this by setting the response type in servlet as follows => response.setHeader("Content-Disposition", "attachment; filename=" + fileName); .When the jsp page loads the user is shown a Open Save dialog box for downloading the file. The user can download the file or cancel the operation.
    But now I need to track if the user has downloaded the file successfully on his m/c , depending on which a flag will be updated in the database . I am not able to track this event . Pls help how I can check if the file has been downloaded successfully and do further processing.

    This is fully dependent on the client side. You can never rely on that.
    In most cases you could check if any byte of the file is written to the outputstream and/or no IOException is been thrown, but some webbrowsers (such as Firefox) will download the file immediately while the client still need to choose 'save' or 'cancel'. Only when the client chooses 'cancel' the download will be aborted and the file will be deleted. But if the file is small and/or the network is fast, then the file download might be already completed at that time.
    Again, you can never rely on what happens at the client side.

  • Open/Save Dialoge Box covers the whole screen - CS3/Vista

    Hi,
    I´m using Photoshop CS3 on Windows Vista and I have the following problem:
    I can´t reduce the open/save dialoge box in Photoshop CS3 as I could in earlier versions, which I find very inconvenient.
    It stretches over the whole screen and there seems to be no way of reducing it. There are handles at the corners but they don´t work.
    Is this normal in CS3 or could it be just a wrong setting in Windows?
    I hope somebody can help me on this, thank you so much!
    Best regards,
    Mike

    Is this normal in CS3 or could it be just a wrong setting in Windows?
    No, it's not normal. There are two things I can think of:
    - the dialog repositioning feature of your graphics card is not working properly (NVidia Desktop etc.)
    - you resized the dialog in another program and now the huge size has become the system default
    In both cases the solution should be pretty obvious - either adjust the settings/ turn off the graphics card's special features or resize the dialog back in the program it was turned huge in the fi8rst place. For the latter, also checking your more general folder view options as well as manually deleting desktop.ini files may offer a way out.
    Mylenium

  • Open/Save Dialog Box Freeze

    Hello,
    Since updating to 10.4.7, the open/save dialog box freezes (beachball) after selecting a folder. Can anyone please point me in the right direction in solving my issue.
    I used the ComboPPC updater and then ran Cocktail to repair permissions, cron scripts, clear caches etc.
    I recently posted about the Finder freezing instead I should have mentioned that it was the Open/Save dialog box.
    Regards,
    David

    Hi,
    I am using model dialog box.
    on page header i have copy The code as given in this http://jqueryui.com/dialog/#modal-message link
    //  page header code
    <!doctype html> <html lang="en"><head>  <meta charset="utf-8" />  <title>jQuery UI Dialog - Modal message</title>  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>  <link rel="stylesheet" href="/resources/demos/style.css" />  <script>  $(function() {    $( "#dialog-message" ).dialog({      modal: true,      buttons: {        Ok: function() {          $( this ).dialog( "close" );        }      }    });  });  </script></head><body> <div id="dialog-message" title="Download complete">  <p>    <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>    Your files have downloaded successfully into the My Downloads folder.  </p>  <p>    Currently using <b>36% of your storage space</b>.  </p></div> <p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p>  </body></html> My Button name is "DOWNLOAD" and on button actions "REDIRECT TO URL"
    on URL TARGET value is ==javascript: myFunction();
    where i have to write this code to bind my apex buttons with dialog box.
    apex.submit(myRequest);the steps i have written above, am doing right or not? Please help to place the code in apex with a right way.
    Thanks & Regards
    Vedant
    Edited by: Vedant on Jan 28, 2013 12:53 AM

  • 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.

  • Can't drag sidebar items in "open/save" dialog boxes - Mountain Lion

    (First time poster)  Using Mountain Lion 10.8.3 and InDesign CS6.  Having errors. First was that smart folders made the Open/ Save dialog boxes crash when referenced in the "Favorites" section of sidebar.   Next, and more serious, error, is that I cannot drag/ rearrange my sidebar items in this view. AKA I cannot take "Favorites" on the sidebar and drag that section below "Devices" or "Shared" or "Media" like I normally can in Finder or any other app for that matter.  Recently installed SIMBL and "Colorful Sidebar" app but uninstalled and removed bundle file from SIMBL plugins folder in order to try and resolve this. Hard to say if this problem started before or after the third-party plugin was installed, but regardless, it's gone now, and still having problems.  Help please!  Thanks,

    None of these are InDesign questions.
    I'd suggest asking this is the Apple forums:
    https://discussions.apple.com/index.jspa

  • Find in Open/Save Dialog boxes

    The find in open/save dialog boxes seems to return unexpected results. Say I have two folders one called "Down under" and the other called "Down under 2". If I ask it to find "down" it only returns the file "Down under 2" and other files whose content may have the word "down" in them. The folder "Down under 2" only has jpegs in it. None have "Down" in the file name.
    So what gives?

    Surely someone knows what is going on in spotlight. If I use Easyfind for the search it comes up with both files folders correctly.

  • Unable to run Servlet program using J2EE SDK

    Hello,
    i am a newbie to all this j2ee stuff and servlets even.so the problem that i have maybe a very common one and i hope that most of you may have a fix to it...
    i use J2EE SDK to compile and run Servlet programs.I have a Servlet program with the class name defined as
    public class MyServlet extends HttpServlet ....
    the file is stored as MyServlet.java
    i set the CLASSPATH variable so that the required classes for the compilation of the program can be located.
    the program compiles without any glitches.
    However when i run the program by saying
    java MyServlet
    ( i dont think its any different to run servlet code is it?)
    i get the message
    java.lang.NoClassDefFoundException:MyServlet
    Can someone suggest a remedy?
    thank you
    -NDK

    First, I don't understand what you are trying to do. Running a servlet ?
    Servlets are ran by an application server ! (Apache Tomcat ....).
    Second, is your class in any package ?

  • 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.

Maybe you are looking for

  • Count of rows in a cursor

    please help me with the function to count the number of rows in a cursor.

  • Retrieve All Rows in Disocverer Plus

    Hi, Can we set the 'Retrieve All Rows' option in Discoverer Plus ? I can go to Tools > Retrieve All Rows. But is there any way (like a checkbox) we can set it permanantly so that every user need not to look into it ? Thanks! Yogini

  • Communication with modbus devices

    Hello All, My name Peter, I am currently exploring what LabVIEW has for instrument communication. I have explored a little on NI-Visa and used it for instrument communication through USB and Ethernet. My next task just now is to see how I can communi

  • BDC Calling MIGO transaction with different actions

    Hi everyone, i am doing a  BDC for MIGO t-code....to create Good Receipt w.r.t Purchase Order..... While executing the Pgm....if some other user has opened the MIGO t-code in DISPLAY mode then that pgm is not able to call the MIGO t-code...to create

  • Error 105 on publishing - what does it mean?

    I'm getting this in the publish logs when trying to publish a page:      EXCEPTION: Asset save failed for Content_A:1349711142754,1349711142764,1349711142734,1349711142774, Error saving an asset Asset.SaveAll : com.openmarket.basic.interfaces.AssetEx