Save As feature in JSP

Hi there,
I have a JSP where the user needs to be shown a dialog box onclicking the "Browse" button (like the "Save As" feature on browser right click).
Currently the way I have it is that I have used Input type="file" in my form in the JSP.
But the problem is that this will not allow non-existing new filenames to be entered.
But the good thing was that I didnt have to program anything for the MS window to browse the filesystem.
Is there something like this for "Save as" or do I have to explicitly program for this.
I'd really appreciate your help.
Thanks in advance!

And here is the code scriptlet.....
<%@ taglib uri="/coreTaglib" prefix="core" %>
<%@ taglib uri="/dspTaglib" prefix="dsp" %>
<%     try {
               String fileName = "C:\\Temp\\Baseline_Export.xls"; //request.getParameter("fileName");
               File f = new File(fileName);
               if(!f.exists() || f.isDirectory()) { throw new Exception("The requested file does not exist.");     }               
               String ctype = "application/vnd.ms-excel";
               response.setContentType(ctype);               
               response.setContentLength((int)f.length());               
               byte[] buffer = new byte[1024];               
               int r = 0;               
               FileInputStream fin = new FileInputStream(f);               
               OutputStream out1 = response.getOutputStream();               
               while((r = fin.read(buffer, 0, buffer.length)) != -1) {                    
                    out1.write(buffer, 0, r);               
               try {                    
                    fin.close();                    
                    out1.flush();                    
                    out1.close();               
               } catch(Exception e) {}               
               out1 = null;               
               fin = null;               
               buffer = null;
          catch (Exception ex){
               String msg = ex.getMessage();     
               System.out.println("Exptn in ExcelRenderer...."+ex);          
               response.setContentType("text/html");               
               response.setContentLength(msg.length());               
               PrintWriter out2 = response.getWriter();               
               out2.println(msg);               
               out2.flush();               
               out2.close();               
%>

Similar Messages

  • Where did the "save as" feature go?

    I just opened up a Pages document, after my Lion upgrade.  I want to use the orginal document, make changes and save as a new document.  However, when I clicked on "File" to go to the "Save As," I discovered it is no longer there.  Where is the "Save As" feature now.  This is, obviously, a crucial need.

    Pondini wrote:
    In most cases, though, you don't need a separate file.  Just make a Version with Cmd+S.
    Much faster, and takes up much less space, since it only saves the changes, not the whole document.
    As a work machine processing files, folders, and graphics, in many cases I do, everyday.
    Changing file name and format and still have the original to work with.
    Seems crazy to me.
    Message was edited by: leroydouglas
    update:  I was successfiul to create a keyboard shortcut for Duplicate not Export (my preferred.)

  • I am running a laptop with windows 7 on it and trying to use the save as feature in Photoshop CS6 and won't let me save as anything. Please help?

    I am running a laptop with windows 7 and am trying to use the save as feature in Photoshop CS6 and it wont let me save as anything. Can someone please help me with this?

    A screenshot of your Photoshop work area showing the open file you want to save as, the Layers panel open, and the Save as... dialog open might give us a clue as to what is going on.
    To take a screenshot and save it as a file
    For Windows 7, Printscreen, open a New File in Photoshop, Ctrl v to paste, then save as jpeg (the other trick was for windows 8)
    Use the Camera icon on your reply to upload it.
    Also File > Save for Web is a good workaround if you just need a jpeg, png, or gif.
    Gene

  • Where is save as feature on Lion ?

    Where is save as feature in Lion ?

    I understand that in Mountain Lion (10.8), Save-As is back - but it is a HIDDEN feature. To be honest, I never got used to the Duplicate function in Lion, so I am thrilled that this may be back - it was in the beta version of Mountain Lion.
    Do a Google search to find the article that discusses this - if I recall, I read it on Gizmodo. Once you find it, I think you can turn it on so that Save-As is a permanent feature, or one accessible via the Control or Option keys.
    Best of luck! I am thrilled!

  • How to disable the save as feature in secured pdf

    Hello ! i have a small issue i recently create a secured pdf file with enable comment option.so save and save as will enable. but i need to disable save as feature because anyone can save it to another format. so then secured feature will disable. please give me a good answer if anyone knows. it'll really help me.

    But of course read carefully and BELIEVE AND UNDERSTAND the warning when you set security

  • Feature of JSP for access command of UNIX

    hello sir ,
    I interesting JSP for developer application on internet . Now , I would like feature of JSP that
    what JSP use command for access comand of UNIX example ls ,mail ,bg (background process) and
    return result of command example mail, bg (background process) to JSP ? please tell me too . Thank you very much.

    thank you for reply question to me
    Please talk detail about runtime & process class to me please and example for JSP call command UNIX "mail" via JSP :-)

  • Auto Save/Cache Feature?

    Is there any chance Photoshop can develop a Auto Save/Cache feature, kind of similar to what Microsoft Word and other programs use?
    If you're not familiar, if the program crashes or closes without saving, upon re-opening the program, it gives you a message to recover the unsaved data.
    I'm tired of constantly getting crashing glitches in my photoshop program that causes me to lose all the work I've done.
    I know the simple solution is to constantly save your work, but when I get into the zone with my work and I start getting on a roll with my artwork, I don't always remember to save.
    I can work for a few hours when I get into my zone, and when the program glitches and crashes, all that data, artwork, inspiration and time is lost forever, and it is very discouraging.
    I think developing an Auto Save/Cache feature would greatly benefit the program and help artists like me greatly.

    Noel Carboni wrote:
    Though it always seems to work for me, some Windows users have reported that it doesn't actually auto-save for them.
    They need to move to OS X, then. It has better aesthetics, too.

  • Save as feature has disappeared from the drop down menu in Pages.

    I can no longer SAVE AS feature. Is this an upgrade problem?

    Press the Option/Alt key when you click on the File menu.

  • How to disengage the Firefox save password feature

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/793758]''
    How can I disengage the save password feature for already saved passwords?

    If you use a weak master password that can easily be constructed via a dictionary look up then it doesn't matter how long that password is.<br />
    If you want to make it difficult then use a MP that contains uppercase and lowercase characters (e.g. a-z, A-Z) and have digits (0-9) and punctuation characters and symbols (`~!@#$%&*()-_=+[]{}\;:'",.<>/?) and the length should at least be 8, but better use at least 12.
    Never use words that can be found or constructed via a dictionary look up, even if there are numbers added or some characters have a different case.
    See also http://en.wikipedia.org/wiki/Password_strength
    The names and passwords are encrypted with a Triple-DES key that is stored in key3.db and a master password adds an additional level to that encryption.<br />
    If you do not use a master password then having access to key3.db and signons.sqlite is sufficient to have access to the encrypted names and passwords.<br />
    Make sure that you remember that master password or else all your passwords are lost.
    See http://en.wikipedia.org/wiki/Triple_DES - TripleDES (CBC mode)

  • TS4435 Apple's temporary fix to drag each picture in iPhoto is not really a solution for a big pic file. Better to use the save all feature and save to a temporary place before importing it to iPhoto.

    Apple's temporary fix to drag each picture in iPhoto is not really a solution for a big pic file. Better to use the save all feature and save to a temporary place before importing it to iPhoto.

    Can you explain why the image size matters when dragging and dropping into iPhoto?

  • Save as Feature in Web page ( JSP)

    Hi,
    I want the user to be able to save some data on the browser machine.
    I have a button Save as on the page. When User clicks that a file selector dialog pops up with a default file name. User can select the directory and file name and save it. The server program is in JSP. How do I do it? I am able to file selector dialog by setting content type as undefined or CSV.
    But I am not able to give a default file name. Please help.
    Regards,
    Sanjay

    buddy...
    try this ..it'll help u to set the file name in the save as dialog box...
    response.setHeader("Content-Disposition","attachment;filename=filename.extension");
    for ex...
    filename.extension = Gates.xls

  • Open/save word document in jsp

    I can open a word document in jsp but i don't know how to save and close it to where i want again inside same jsp.
    I find a code that do thing i want to do but it was written in vb script.
    How can i convert vb code below to java / jsp?
    Dim wrdApp As Word.Application
    MyStr = Format(dtMyDate, "mmm dd, yyyy") & ".doc"
    Set wrdApp = New Word.Application 'released first resources
    With wrdApp
    .Documents.Add "normal.dot", , , True
    strPatientName = txtName.Text
    strFileName = "c:\MJCC\Lab\" & strPatientName & "_" & MyStr
    .ActiveDocument.SaveAs strFileName
    .ActiveDocument.Close
    .Quit
    End With
    Set wrdDoc =Nothing

    <%@ page contentType="application/vnd.ms-excel" language="java"%>
    <meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=iso-8859-1">
    by using this 2 codes, when i run this page, it will pop up a box for me to save the jsp file..
    i'm able to save it in xls / csv format...
    so, mayb you can try change the ms-excel to ms-word or something else..
    hope this is useful...

  • Unable to choose save as feature in pages

    Hello,
    I have pages for macbook pro and it doesn't give me the save as option to choose from the file menu.  Any suggestions?
    MacDeven

    Hold down the option key as you select the File menu.
    This is now an OSX feature, not Pages.
    Peter

  • Save As feature in many programs

    I upgraded to Mavericks and use Microsoft Office 2011. When performing a "save as" action for a document, I normally search for the proper folder through the spotlight feature that shows up in the menu. Since the update, as son as I write any letter in there, the “save” button get disabled and I cannot open any of the folders that show up. Anyone experiencing this issue? I use this all the time… This also happens in other programs (Acrobat) but not in Autocad.
    I have tried to repair permissions and reinstalled office.
    I would appreciate any help on this!

    I upgraded to Mavericks and use Microsoft Office 2011. When performing a "save as" action for a document, I normally search for the proper folder through the spotlight feature that shows up in the menu. Since the update, as son as I write any letter in there, the “save” button get disabled and I cannot open any of the folders that show up. Anyone experiencing this issue? I use this all the time… This also happens in other programs (Acrobat) but not in Autocad.
    I have tried to repair permissions and reinstalled office.
    I would appreciate any help on this!

  • How to save data from a JSP Form to a xml file

    Hi All,
    I want to save JSP Form Fields (like name, contact etc) to a xml.
    When i chick on submit button of form all the entered fields should be saved into a xml file.
    Can any one send me a sample code, as I am new to JSP and XML.
    Thanks you All.

    You could
    - send the form input as request parameters (e.g. site.jsp?name=value&name=value) (done in html)
    - get the parameters with request.getParameter("name")
    - use [Java's xml lib|http://developerlife.com/tutorials/?p=25] to create the xml file [(jDom.org|http://jdom.org/] is another nice and simple xml lib)

Maybe you are looking for