Securing file download links

As per the File upload/download How-to at http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14377/up_dn_files.htm#sthref153
downloading a file involves writing a stored procedure and invoking it directly using the DAD and mod_plsql. For example, /pls/htmldb/owner.procedure?p_file_id=1234
This link bypasses the Apex show engine so even if I have all the security in the world in Apex using authentication schemes, authorization schemes, etc, a authenticated user in Apex can just right click on the Download link, shoot it off to someone else who can download the file without even logging in to my application!
How can these "download links" be secured so that only authenticated users can access them only from an Apex session?
Thanks

Thank you Vikas.
The reason I ask is I get a compilation error in my procedure.
I am no PL/SQL expert so I am sure my syntax or logic is wrong.
I am using APEX version 2.0
Error(7,19): PLS-00103: Encountered the symbol "." when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table LONG_ double ref char time timestamp interval date binary national character nchar The symbol "<an identifier>" was substituted for "." to continue.
CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
        v_mime  VARCHAR2(48);
        v_length  NUMBER;
        v_file_name VARCHAR2(2000);
        Lob_loc  BLOB;
        APEX_APPLICATION.G_FLOW_ID := 100;
BEGIN
--testing security
IF NOT wwv_flow_custom_auth_std.is_session_valid then
    -- display this message or a custom message.
htp.p('Unauthorized access - file will not be retrieved.');
    -- You can do whatever else you need to here to log the
    --     unauthorized access attempt, get the requestor's
    --     IP address, send email, etc.
    RETURN;
END IF;
        SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
                INTO v_mime,lob_loc,v_file_name,v_length
                FROM file_subjects
                WHERE id = p_file;
              -- set up HTTP header
                    -- use an NVL around the mime type and
                    -- if it is a null set it to application/octect
                    -- application/octect may launch a download window from windows
                    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
                -- set the size so the browser knows how much to download
                htp.p('Content-length: ' || v_length);
                -- the filename will be used by the browser if the users does a save as
                htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                -- close the headers           
                owa_util.http_header_close;
                -- download the BLOB
                wpg_docload.download_file( Lob_loc );
end download_my_file;
/Thanks
VC

Similar Messages

  • Creating a file download link on jsp

    I have the following on my jsp. The code worked fine until I tried to use it in a new html design page.
    <code>
    //page name is index.jsp
    try //DISPLAY THE CONTENTS OF THE DATA DIRECTORY
    File dirname = new File(PATH); // create an instance of the File class
    if (dirname.exists()&&dirname.isDirectory())//check to see if File class dirname exists and is valid
    String [] allfiles = dirname.list();//create an array of files in the dirname File class
              for (int i=0; i< allfiles.length; i+=2)//loop through allfiles[] and print out file links
    out.println("<br><table border='1' cellspacing='1' width='99%'>");
                   out.println("<tr><td width='50%' class='pageFont'><input type='checkbox' name='cb' value='"+allfiles[i]+"'>"+allfiles[i]+"      ");
    %>
    <a class="a" href="index.jsp?downfile=C:\\data\\<%=allfiles[i+1]%>">DOWNLOAD</a></td>
    <% if(i+1 < allfiles.length)//PRINTS OUT THE SECOND TD SO THAT WE HAVE 2 COLUMNS OF LINKS
    out.println("<td width='50%' class='pageFont'><input type='checkbox' name='cb' value='"+allfiles[i+1]+"'>"+allfiles[i+1]+"      ");
    %>
    <a class="a" href="index.jsp?downfile=C:\\data\\<%=allfiles[i+1]%>">DOWNLOAD</a></td></tr>
    <%
    out.println("</form></font></table>");
    catch (IOException excep)
         out.println("An IO exception has occured.");
    </code>
    Then when clicked this code is run:
    <code>
    try{
    //CHECK TO SEE IF THE FILE HAS BEEN CLICKED TO DOWNLOAD SINGLE FILE
    if (request.getParameter("downfile") != null)
    String filePath = request.getParameter("downfile");
    File f = new File(filePath);//CREATE AN INSTANCE OF THE FILE CLASS AND POINT IT TO THE LOCATION OF THE DIRECTORY CONTAINING THE FILES
    if (f.exists() && f.canRead())
    response.setContentType ("application/octet-stream");
    response.setHeader ("Content-Disposition", "attachment;filename=\""+f.getName()+"\"");
    response.setContentLength((int) f.length());
    BufferedInputStream fileInputStream = new BufferedInputStream(new FileInputStream(f));
    int i;
    out.clearBuffer();
    while ((i = fileInputStream.read()) != -1) out.write(i);
    fileInputStream.close();
    out.flush();
    </code>
    When I click on this link I get the download dialog box. If I open it I get the following open up in notepad(the files I am trying to give download links are .txt files)
    Below is what is displayed in notepad ALL on 1 line:
    <html>
    <head>
    <LINK rel="stylesheet" ty
    That is displayed in all of the links that I click on. It is the first few lines of html code for index.jsp.
    I know this code is probably not a good way of doing what I need but I got it to work fine until the change.
    I am sure there is an easier way to code the download link without resubmitting the page.
    Thanks in advance!!

    Well all was fine with this jsp until I moved it to ApacheJServ. Now the problem has resurfaced(although it is a little different now)
    I had moved the following code to the top of my page:
    //CHECK TO SEE IF EITHER DOWNFILE OR ZIPFILE VARIABLE EXIST, AND IF THEY DO SET CONTENT TYPE BEFORE SENDING ANY HTML CODE TO THE BROWSER
    try{
    //CHECK TO SEE IF THE FILE HAS BEEN CLICKED TO DOWNLOAD SINGLE FILE
        if (request.getParameter("downfile") != null)
                String filePath = request.getParameter("downfile");
                File f = new File(filePath);//CREATE AN INSTANCE OF THE FILE CLASS AND POINT IT TO THE LOCATION OF THE DIRECTORY CONTAINING THE FILES
                    if (f.exists() && f.canRead())
                        response.setContentType ("application/octet-stream");
                        response.setHeader ("Content-Disposition", "attachment;filename=\""+f.getName()+"\"");
                        response.setContentLength((int) f.length());
                        BufferedInputStream fileInputStream = new BufferedInputStream(new FileInputStream(f));
                        int i;
                        out.clearBuffer();
                        while ((i = fileInputStream.read()) != -1) out.write(i);
                            fileInputStream.close();
                            out.flush();
                            response.flushBuffer();
    catch (Exception e){}
    //This is where the java code ends and the javascript/html code begins.Then further into the page I create the file download links like so:
                            <a class="a" href="main.jsp?downfile=C:\\data\\<%=allfiles[i+1]%>">DOWNLOAD</a>I know this isnt a secure way of doing this but I am on a intranet.
    The problem I am having now is that when I click on one of the links and download the file and then open it, I get the contents of the file plus concatenated to the end of it is the first few HTML lines of the actual jsp that I downloaded the file from. Before I was just getting the first few lines of html from the jsp, not the actual contents of the downloaded file.
    This is an example of what I am getting:
    This is the contents of the file that I downloaded.//This is where the file contents ends.
    <html>
    <head>
    <LINK rel="stylesheet" type="text/css" href="default.css">
    <script language="JavaScript1.2">
    //function that allows user to select all checkboxes
    function doIt(v)
    for(var i=0;i<document.form1.cb.length;i++)
       document.form1.cb.checked=eval(v);
    function swap(imageName,image)
    imageName.src = "templateImages/"+image;
    function imageOver(imageSrc, imageName)
         changeImage = new Image();
         changeImage.src = imageSrc;
         document.images[imageName].src = changeImage.src;
    var hide = true;
    function hideShow( ) /
    Any morre ideas?
    TIA!
    BTW, I went to ApacheJServ because they wont let me use tomcat :(

  • Website image and zip file download links not working in Dreamweaver Air application

    Hi
    I have successfully created and AIR app for an existing business website using the Dreamweaver AIR Extension. The site works very well in all respects except for the part where we have high resolution images and zip files available for download. The download links refuse to do anything, and right-click (PC) / ctl-click (Mac) does nto work either.
    I suspect this may be an AIR sandbox/security issue but am I correct and what can I do to fix it?
    Thanks in advance for any assistance you may be able to give.
    Martin

    I am now facing the same problem. I wrote a servlet .
    code like this
             response = (HttpServletResponse) faces.getExternalContext().getResponse();
             response.setContentType("application/x-download");
             String agent = request.getHeader("USER-AGENT");
             boolean isIE=false;            
            if (null != agent && agent.indexOf("MSIE")!=-1) { 
                isIE=true;
            if (isIE) {
                fileName = URLEncoder.encode(fileName, "UTF-8");
            } else {
                fileName = new String(fileName.getBytes("utf-8"), "ISO-8859-1");
            response.setHeader("Content-Disposition","attachment;filename="+fileName);
            ServletOutputStream os = response.getOutputStream();
            byte b[]=new byte[1024];
            int n;
            while((n=in.read(b))!=-1){
                os.write(b,0,n);
           in.close();
           os.close();
    and i open a new window refer to above jsp ,also i set a breakPoint at os.close(),the program has passed through,but nothing happened in the window.
    If i use IE or FF ,the browser will open a small window to allow me select whether open or  save the file.So can anybody give me some advice.Is it because air using webkit engine and the engine does not do this kind of job?
            Thanks.

  • Windows Vista, 7 and 8 ISO / Image file Download Links

    Series: How to Re-Install Windows when you don't have the Recovery Discs
    Intro: What is an ISO? Why is it used? 
    Step 1 - Get the ISO - ISO Download Links
    Step 2 - Burn the ISO to a DVD or USB   
    Step 3 - What to do with the ISO DVD/USB? Change the Boot Order  
    Step 4 - What to do After Windows is Installed? How to Get HP Drivers?    
    Step 1 - Get the ISO - ISO Download Links
    First, look at the Product Key label on the bottom of the computer and make sure you can still read it, before proceeding.
    How is this legal?   As long as you have the Product Key (from the bottom of a computer you paid for) for the corresponding version of Windows you download, it is perfectly legitimate and legal.
    The ISO Links: 
    Windows Vista SP1  32 & 64-bit
    *****With that link, you will have to combine the three files into an Image file (aka ISO) first (How to create an image file from files/folders) , using a program like ImgBurn.*****
    Windows 7 32 & 64-bit
    Windows 8 32 & 64-bit
    See Step 2 - Burn the ISO to a DVD or USB
    If you have any questions, create a new post (How to Create a New Post - Video), copy and paste it's link into a private message to me, and I will respond on your thread

    You shouldn't need to edit any of the files. The Windows 7 ISO is a retail, untouched version. It doesn't have a Product Key embedded into it.
    You should be able to use a Windows 7 Product Key from the label on the bottom of the computer with no issues. The installation will ask you for a Windows 7 Product Key. The only exception would be if the Product Key were in use on a different computer. From my understanding, as long as it is not already in use, it should activate.
    Please let me know if you have any questions on that

  • OrcDocDomain File Download Link - (BC4J/ADF) - How to?

    I am able to produce an Upload File in my web application - it works really nicely - , but I am lost on how to produce a download link for those files, once they are stored in the database.
    I am creating an application that deals with document files for my company's intranet. I am using BC4J, ADF, the Oracle Database, and JDeveloper 10.1.3.2
    The files are stored in the oracle database as OrcDocDomain columns.
    As I mentioned at the beginning, I do am able to have my users to upload the files:
    I use the af:inputFile tag to upload the file into the desired jbo View Row. BC4J commits the file storage into the database the way I want it later:
    <af:inputFile value="#{bindings.WorkingDocumentsView1NewDocument.inputValue}"
    label="#{bindings.WorkingDocumentsView1NewDocument.label}"
    required="true"
    binding="#{backing_app_Working_Document.inputText3}"
    id="inputText3"
    inlineStyle="font-size:x-small;" />
    Sweet...
    However, my question now is that, I want my users to be able to download the same file...but I am lost trying to put together a solution for it.
    I have tried with <af:objectMedia source="#{bindings.DocOrd.Source}"/> but it does not work at all. (Please note that I can see that that there is a file in the binding variable DocOrd, because I can display it's mime type in the same web page).
    I have also seen a documentation reference to the class "DownloadFile" of JHeadStart. I think that this class does what I should pretend to do: to render a link/call to the Intermedia Servlet that would produce the download.
    However, I am not using JHeadStart to create my application.
    Does someone know how could I generate this link/call without JHeadStart?
    Thanks by anticipate.
    Rafael.

    Hi.
    I was wondering if anyone has any thoughts or suggestions on above issue please?

  • Securing file download with standard web security and ssl

    Hi,
    I want to put some files for download in my webapp. At the same time, I want to protect these files using standard servlet security and ssl. So I added <security-constraint> in my web.xml and configured tomcat to allow SSL connection. Now I got the files protected as I expected. When I try to access the file directly from browser, tomcat shows me the login page. However, after correct login, I.E. pops up an error saying something like "Internet Explorer cannot download XXX from XXX. The file could not be written to the cache.". The log file showed the following exception:
    javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1154)
         at com.sun.net.ssl.internal.ssl.AppInputStream.available(AppInputStream.java:40)
         at org.apache.tomcat.util.net.TcpConnection.shutdownInput(TcpConnection.java:90)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:752)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error
         at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1443)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1407)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:64)
         at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:747)
         at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
         at org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:400)
         at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:961)
         at org.apache.coyote.Response.action(Response.java:182)
         at org.apache.coyote.Response.finish(Response.java:304)
         at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:281)
         at org.apache.catalina.connector.Response.finishResponse(Response.java:473)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         ... 4 more
    Caused by: java.net.SocketException: Connection reset by peer: socket write error
         at java.net.SocketOutputStream.socketWrite0(Native Method)
         at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
         at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
         at com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:283)
         at com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:272)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:663)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
         ... 15 more
    I've tried separating concerns, for example protect files but not require SSL, and enable SSL but do not protect files. Both works respectively but not together. I also tried using a download4j's DownloadServlet. Still doesn't work.
    Have any of you encouter the same situation? If so, could you enlight me what I did wrong? It maybe just a simple SSL configuration or something. Thanks in advance!
    Jack

    My environment setup is:
    JDK 1.5.01
    Tomcat 5.5.7
    For downloading files, I just use plain old <a href> method. I simply right-click the link and choose "save target as...".
    Thanks,
    Jack

  • File Download links on ADF pages

    Hi All, My requirement is to display no. of document links in pages. I am trying to use <af:fileDownloadActionListener> .
    I am getting list of files/document while loading the page from backing bean and looping through it using <af:forEach>..
    when i click on any link to download the document then fileDownloadBean.download function is called. So in backing function
    download how i know which document user has clicked to download ? Any idea ?
    <af:panelList id="pl1" clientComponent="true" >
    <af:forEach var="file" items="#{fileDownloadBean.listFiles}" >
    <af:commandLink text="#{file}" actionListener="#{fileDownloadBean.buttonClicked}" />
    <af:commandLink text="#{file}" visible="false" id="cl2" actionListener="#{fileDownloadBean.buttonClicked}">
    <af:fileDownloadActionListener filename="#{file}"
    contentType="application/msword"
    method="#{fileDownloadBean.download}" />
    </af:commandLink>
    </af:forEach>
    </af:panelList>

    Hi Tim, I tried to follow same step as mentioned in your blog..but getting y error no object found by id...
    function customHandler(event){ 
    var exportCmd = AdfPage.PAGE.findComponentByAbsoluteId("::cl2");
    alert('hello');
    var actionEvent = new AdfActionEvent(exportCmd);
    actionEvent.forceFullSubmit();
    actionEvent.noResponseExpected();
    actionEvent.queue();
    In my program commandlink is rendering by for each loop...i think in for each loop...iterating component does not assign proper ids...
    <af:panelList id="pl1" clientComponent="true" >
    <af:forEach var="file" items="#{fileDownloadBean.listFiles}" >
    <af:commandLink text="#{file}" clientComponent="true" partialSubmit="true" actionListener="#{fileDownloadBean.buttonClicked}" />
    <af:commandButton text="#{file}" id="cl2" visible="false" clientComponent="true" >
    <af:fileDownloadActionListener filename="#{file}"
    contentType="application/msword"
    method="#{fileDownloadBean.download}" />
    </af:commandButton>
    </af:forEach>
    </af:panelList>
    I appreciate your help..
    Thanks

  • Securing file downloads to a client side download manager.

    The Requirement:
    I need to be able to have clients download a java based download manager that will allow them to log in to their account after they have purchased FLAC music files.
    The download manager would allow for resume. All of this is really not a problem.
    However I need it to be where they cannot download these files directly from server only through this client. And I need to either send a call to server when file is completed or server to somehow track there download.
    Can this download restriction be done via JSSE with SSLand Apache or am I looking at the wrong solution.
    Thanks,
    -M. Bazaillion

    You could have the server use SSL in such a way so that the only identity that can connect to the server is your client.
    You can do that by setting up the server with client authentication required, and a truststore that only trusts one certificate, and install that certificate in the client application's keystore. Don't let that keystore leak and you're done.

  • Download Linked File Save As interference with the Dock

    I have two LCD monitors running at 1440 x 900 (the OS recognizes these LG monitors and establishes the resolution). It seems when I switch to 800 dpi vertical the problem disappears.
    When I am on a web-site and Right-Click to save a file (Download Linked File Save As) option, the tab that Safari opens is so large that the SAVE and CANCEL options are behind the Dock Icons. This is very annoying as I usually move the Safari Window to the second monitor on the left in order to save the file.
    Is there a way to have Safari recognize the higher resolution?
    Thanks,
    Rob

    HI,
    Is there a way to have Safari recognize the higher resolution?
    I don't think so Rob.
    Possibly... Command - or + as you need it.
    will reduce or increase the size of the page first, then try.
    Carolyn

  • Force file download for IE9 on Azure Blob Storage

    Hello,
    I am trying to use Azure Blob Storage as a location for secure file downloads using Shared Access Signature. Everything is working very well, however the problem I am having is I am trying to allow the user to save files from the browser and I have all browsers
    except IE9 working.
    Reviewing this question,
    What content type to force download of text response?
    this works well when I can control all of the headers, however in Azure Blob Storage, I have set the Content-Type to application/octet-stream and this allows all browsers except IE to ask the user to save the file, IE simply opens the file. It appears that
    known file types will open (example .jpg, .wmv etc…).
    In Azure, I have found no way to set
    Content-Disposition: attachment;filename="My Text File.txt"
    Is there a way, using Azure Blob Storage, to use IE to download any file directly from Azure Blob Storage?
    Thanks in advance.

    Hi,
    Actually, we can't set Content-Disposition for blobs, and I can't think of any other workarounds. From my experience, in most case IE's behavior is fine. I would like to know why you have to prompt a download? The user can see the text file, and
    if they wish to save it locally, they have more than one way to do that (copy paste, save file, etc.). If they simply want to read the text and then forget it, that's also fine. They don't even have to download it and then double click a local file to read
    the content.
    If you have to modify the behavior, the only workaround I can think of is to use a web role as an intermediate bridge, and add the Content-Disposition from your web role.
    Best Regards,
    Ming Xu.
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact
    [email protected]
    Microsoft One Code Framework

  • File Download - Security Warning

    Hi,
    We have installed the developing content server under the following options:
    OS - Windows 2008 R2 with sp1
    Database : MaxDB 7.8
    After a successful installation I would maintain the post-Installation.
    For the first step I tried to test the connection to the content Server:
    1. open a Web browser on a host that is connected to your local network
    2. navigate to the following URL like http://<hostname>:1090/ContentServer/ContentServer.dll?serverinfo
    Instead of "Running" the result of test is then like following:
    It comes up a popup with "File Download - Security Waring" and the question "Do you want to save this file, or
    find a program online to ope it?" - Name: contenServer
    Type: Unknown File Type, 265KB
    From: content1
    contentd1 - servername
    Who is to say how it can be solved?
    Thanks a lot in advance,
    Gauguin

    Hi Juan,
    You mean "Capital" that  the link should be case-sensitive:
    http://contentD1:1090/ContentServer/ContentServer.dll?serverinfo
    our content server - contentD1
    If I enter in the browser, it may come the same symptom.
    Have you any idea, to correct the symptom?
    Thanks a lot,
    Gauguin

  • Window 7 32 bit client machine dot net exe running in IE8 or IE9 from server security warning file download issue

    Help me in the issue, Asp dot net exe which run from server in IE 8 window 7 32 bit client machine show security file save download message. This app was running fine if we don't apply any window 7 or IE8 patches. same issue when running in
    IE9. I already run the caspol, add the server link to trusted site with low security. I wonder why it was working fine without any patches.
    I just found that client machine win 7 32 bit has dot net 4.5.1 installed when updated all the patches. after uninstall the dot net 4.5.1. the application worked fine. now I wonder what are the settings need to change to run the application with dot net 4.5.1
    installed on machine. as Microsoft always has these things in window updates. thanks in advance.

    Hi Gparhar,
    In case you are posting on .NET setup forum, I suspect it is not the right forum for your issue, we talks about "setup and deployment of .NET Framework.", if you have problem on installing and uninstalling .NET 4.5.1, we can share you some advice.
    For your specific case, I recommend you consult ASP.NET forum instead:
    http://forums.asp.net/
    Regards,
    Barry Wang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • When i try to run my jsp i get "File Download Security Warning"

    Hi,
    I have created a jsp file which is called UpdateEmpDetails1.jsp
    This jsp file picks up the employee id of the employee and transfers it to the backend servlet called UpdateEmpDetails1.java. The backend servlet looks up the table stored in the database and pulls up all the information stored corresponding to the employee id.Then the servlet stores the information in a session object and forwards it to the UpdateEmpDetails2.jsp
    I display the information which has been forwarded by the servlet in the HTML fields of UpdateEmpDetails2.jsp.
    Here the manager can also update the information. When he clicks on submit, the second serlvet UpdateEmpDetails2.java which is linked to UpdateEmpDetails2.jsp picks up the updated information and updates the database. The servlet also displays the message "Your information has been updated". But here is the real problem
    The session variables are being transferred perfectly to the jsp file UpdateEmpDetails2.jsp.
    But when i make any changes to this file and click on submit I get File Download Security Warning. It Says:
    File Download Security Warning
    Do you want to save this file
    Name UpdateEmpDetails2
    Type UnknownFileType
    From LocalHost
    Then I get another file which says
    FileDownload
    Getting FIle Information
    UpdateEmpDetails2 from localhost
    Estimated time left
    Download to:
    Transfer rate:
    Close this dialog box when download is complete
    I am just simply not able to update the employee information in the database due to this message.

    this is what i am trying to do:
    my UpdateEmpDetails1.jsp is as follows:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional //EN">
    <html>
    <head>
    <title>UpdateEmpDetails1.jsp</title>
    <link REL=STYLESHEET
    HREF="JSP-Styles.css"
    TYPE="text/css">
    </head>
    <body BGCOLOR="lightyellow" text="black">
    <h2 align="left"><font color="black">Update Employee Details Page</font></h2>
    <form action="UpdateEmpDetails2" Method="Get">
    <h2 align="left">Please enter the Employee ID of the employee whose details you want to edit</h2>
    <table width=50% align="center">
    <tr><td>Employee ID : </td>
         <td><INPUT TYPE="TEXT" name="employeeid"><br></td></tr>
    <tr><td><center><INPUT TYPE="SUBMIT" VALUE="SUBMIT"></center></td></tr>
    <tr><td><center><INPUT TYPE="RESET" VALUE="RESET"></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    my update EmpDetails1.java is as follows:
    package com.update;
    import com.database.*;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    public class UpdateEmpDetails1 extends HttpServlet
         public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
              HttpSession session = request.getSession();
              String X = request.getParameter("employeeid");
              System.out.println("Employee ID:" + X);
              //Establishing the jdbc connection
              try
                   Database db = new Database();
                   Connection con = db.useConnection();
                   String query = "Select * from employees where employeeid=?";
                   PreparedStatement stat = con.prepareStatement(query);
                   System.out.println(stat);
                   stat.setString(1,X);
                   ResultSet rs = stat.executeQuery();
                   while(rs.next())
                        String A = rs.getString("employeeid");
                        String B = rs.getString("firstname");
                        String C = rs.getString("lastname");
                        String D = rs.getString("gender");
                        String E = rs.getString("dateofbirth");
                        String F = rs.getString("address");
                        String G = rs.getString("postalcode");
                        String H = rs.getString("phone");
                        String I = rs.getString("mobile");
                        String J = rs.getString("designation");
                        String K = rs.getString("joindate");
                        String L = rs.getString("leavedate");
                        String M = rs.getString("email");
                        String N = rs.getString("qualification");
                        String O = rs.getString("empstatus");
                             System.out.println("comparison successful");
                             session.setAttribute("employeeid",A);
                             session.setAttribute("firstname", B);
                             session.setAttribute("lastname", C);
                             session.setAttribute("gender", D);
                             session.setAttribute("dateofbirth", E);
                             session.setAttribute("address", F);
                             session.setAttribute("postalcode", G);
                             session.setAttribute("phone", H);
                             session.setAttribute("mobile", I);
                             session.setAttribute("designation", J);
                             session.setAttribute("joindate", K);
                             session.setAttribute("leavedate", L);
                             session.setAttribute("email", M);
                             session.setAttribute("qualification", N);
                             session.setAttribute("empstatus", O);
                             String url="/UpdateEmpDetails2.jsp";
                             RequestDispatcher dis = request.getRequestDispatcher("/UpdateEmpDetails2.jsp");
                             System.out.println("Dispatching" + dis);
                             dis.forward(request, response);
              catch(Exception e)
                   System.out.println(e);
    my UpdateEmpDetails2.jsp is as follows:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>UpdateEmpDetails2.jsp</title>
    <link REL=STYLESHEET
    HREF="JSP-Styles.css"
    TYPE="text/css">
    </head>
    <body BGCOLOR="lightblue" text="black">
    <h1 align="center"><font color="black">Update Employee Details Page</font></h1>
    <form action="UpdateEmpDetails2" Method="Get">
    <table width=50% align="center">
    <tr><td>EMPLOYEE ID:</td>
         <td><INPUT TYPE = "HIDDEN" name="employeeid" value=<%=session.getAttribute("employeeid")%> ></td></tr>
    <tr><td>FIRST NAME :</td>
         <td><INPUT TYPE = "TEXT" name="firstname" value=<%=session.getAttribute("firstname")%> ></td></tr>
    <tr><td>LAST NAME :</td>
         <td><INPUT TYPE = "TEXT" name="lastname" value=<%=session.getAttribute("lastname")%> ><br></td></tr>
    <tr><td>GENDER :</td>
         <td><INPUT TYPE = "TEXT" name="gender" value=<%=session.getAttribute("gender")%> ><br></td></tr>
    <tr><td>DATE OF BIRTH (IN MM/DD/YYYY FORMAT) :</td>
         <td><INPUT TYPE = "TEXT" name="dateofbirth" value=<%=session.getAttribute("dateofbirth")%> ><br></td><tr>
    <tr><td>ADDRESS :</td>
         <td><INPUT TYPE = "TEXT" name="address" value=<%=session.getAttribute("address")%> ><br></td></tr>
    <tr><td>POSTALCODE:</td>
         <td><INPUT TYPE = "TEXT" name="postalcode" value=<%=session.getAttribute("postalcode")%>><br></td></tr>
    <tr><td>PHONE:</td>
         <td><INPUT TYPE = "TEXT" name="phone" value=<%=session.getAttribute("phone")%> ><br></td></tr>
    <tr><td>MOBILE:</td>
         <td><INPUT TYPE = "TEXT" name="mobile" value=<%=session.getAttribute("mobile")%> ><br></td></tr>
    <tr><td>DESIGNATION : </td>
    <td><INPUT TYPE="TEXT" name="designation" value=<%=session.getAttribute("designation")%> > <br></td></tr>
    <tr><td>JOIN DATE:</td>
         <td><INPUT TYPE = "TEXT" name="joindate" value=<%=session.getAttribute("joindate")%> ><br></td></tr>
    <tr><td>LEAVE DATE:</td>
         <td><INPUT TYPE = "TEXT" name="leavedate" value=<%=session.getAttribute("leavedate")%> > <br></td></tr>
    <tr><td>EMPLOYEE EMAIL:</td>
         <td><INPUT TYPE = "TEXT" name="email" value=<%=session.getAttribute("email")%> ><br></td></tr>
    <tr><td>EMPLOYEE QUALIFICATION:</td>
         <td><INPUT TYPE = "TEXT" name="qualification" value=<%=session.getAttribute("qualification")%> > <br></td></tr>
    <tr><td>EMPLOYEE STATUS:</td>
         <td><INPUT TYPE = "TEXT" name="empstatus" value=<%=session.getAttribute("empstatus")%> > <br></td></tr>
    <tr><td><center><INPUT TYPE="SUBMIT" VALUE="SUBMIT"></center></td></tr>
    <tr><td><center><INPUT TYPE="RESET" VALUE="RESET"></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    my UpdateEmpDetails2.java is as follows:
    package com.update;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import com.database.*;
    public class UpdateEmpDetails2 extends HttpServlet
         public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
              PrintWriter out = response.getWriter();
              response.setContentType("texthtml");
              String A = request.getParameter("employeeid");
              out.println(A);
              String B = request.getParameter("firstname");
              out.println(B);
              String C = request.getParameter("lastname");
              out.println(C);
              String D = request.getParameter("gender");
              out.println(D);
              String E = request.getParameter("dateofbirth");
              out.println(E);
              String F = request.getParameter("address");
              out.println(F);
              String G = request.getParameter("postalcode");
              out.println(G);
              String H = request.getParameter("phone");
              out.println(H);
              String I = request.getParameter("mobile");
              out.println(I);
              String J = request.getParameter("designation");
              out.println(J);
              String K = request.getParameter("joindate");
              out.println(K);
              String L = request.getParameter("leavedate");
              out.println(L);
              String M = request.getParameter("email");
              out.println(M);
              String N = request.getParameter("qualification");
              out.println(N);
              String O = request.getParameter("empstatus");
              out.println(O);
              try
              Database db = new Database();
              Connection con = db.useConnection();
              String query= "update employees set employeeid=?,firstname=?,lastname=?,gender=?,dateofbirth=?,address=?,postalcode=?,phone=?,mobile=?,designation=?,joindate=?,leavedate=?,email=?,qualification=? where employeeid=?";
              PreparedStatement stat = con.prepareStatement(query);
              stat.setString(1, B);
              stat.setString(2, C);
              stat.setString(3, D);
              stat.setString(4, E);
              stat.setString(5, F);
              stat.setString(6, G);
              stat.setString(7, H);
              stat.setString(8, I);
              stat.setString(9, J);
              stat.setString(10, K);
              stat.setString(11, L);
              stat.setString(12, M);
              stat.setString(13, N);
              stat.setString(14, O);
              stat.setString(15, A);
              System.out.println(stat);
              int i = stat.executeUpdate();
              if (i!= 0)
              System.out.println("The record has been updated");
              else
                   System.out.println("Sorry ! failure");
              ResultSet rs = stat.executeQuery("select * from employees");
              System.out.println(rs);
              while(rs.next())
                   out.print("<table border='1'>");
                   out.println(rs.getString(1) + "<br>");
                   out.println(rs.getString(2) + "<br>");
                   out.println(rs.getString(3) + "<br>");
                   out.println(rs.getString(4) + "<br>");
                   out.println(rs.getString(5) + "<br>");
                   out.println(rs.getString(6) + "<br>");
                   out.println(rs.getString(7) + "<br>");
                   out.println(rs.getString(8) + "<br>");
                   out.println(rs.getString(9) + "<br>");
                   out.println(rs.getString(10) + "<br>");
                   out.println(rs.getString(11) + "<br>");
                   out.println(rs.getString(12) + "<br>");
                   out.println(rs.getString(13) + "<br>");
                   out.println(rs.getString(14) + "<br>");
                   out.println(rs.getString(15) + "<br>");
                   out.print("<br>");
              catch (Exception e)
                   System.out.println(e);
                   e.printStackTrace();
    Now as soon as i click on the submit button of the first jsp i get "File Download security warning message"
    I am new to jsp and i am not able to troubleshoot this

  • Problem download secure files performance test kit

    Hi, I'm trying to download "secure files performance test kit" from here: http://www.oracle.com/technetwork/database/sftestkit-099298.html
    From here it should only be to push the "download" label - but this is not working.
    Instead I'm redirected to http://www.oracle.com/technetwork/indexes/products/index.html
    where I can't find what I'm looking for.
    Please help,
    regards,
    Harald

    SecureFiles Performance Test Kit
    The SecureFiles Performance Test Kit compares the performance of SecureFiles to older LOBs or BasicFiles. SecureFiles and LOB performance is measured using two of the popular database driver protocols, namely the JDBC OCI driver (Type II driver) and the JDBC Thin driver (pure Java, Type IV driver). In addition, the kit also compares performance under different caching and logging conditions.
    Throughput is the metric used to measure performance for both reads and writes. The kit can be customized to run with different lob sizes, number of iterations, concurrent threads etc. The README file contains more information on setting up the kit and running the tests.
    below this you can find the download button:- click the link
    Download the SecureFiles Performance Test Kit.

  • How to download a file under link in FF?

    there is a 'save target as...' popup menu option in "big" firefox, which I use to skip default action for specific files. I.e. to download a pdf file to read it later instead of open it in acroread right now.
    How can I get the same function in mobile version of FF?
    Thanks a lot.

    Since the last update I've got the same problem. When I click a download link (mp3), instead of downloading the file FF opens a new tab and start playing the mp3. This is not what I want. I want to download the file at home so that I can listen to it later when there is no internet connection available. When I long click the download link there are some options, but there is no option "save link as".
    Now I have to use Chrome to achieve my goal.
    Please help!

Maybe you are looking for

  • How do i use itunes on a 3g without a sim card?

    I reset my iphone 3g to factory settings to give to my son to use as an ipod.  Now it will not function at all becasue it has no sim card.  (My other son removed it when he visited here and used the phone.)  I was told to put in a sim card from my ip

  • Having major issues with update 8.2 for my iPad 2.  Can I undo upgrade?

    JJust upgraded to 8.2 for my iPad 2.  Huge problems!  Slow, freezing pages.  Cannot use my locaL public library web site.  Keeps moving me out of web pages, etc.  Can I undo this upgrade?

  • Fork End condition problem in BPM

    Hi All, I am collecting three different types of idocs (consider A, B and C). For collecting idocs I am using BPM. BPM Steps are 1.Block1        a.Fork u2013 3 branches            i. Loop(3 Loops)  Receive u2013 Container Operation(Assign) -- Contai

  • PDA Mouse Down Event on Picture Control

    While using the Mouse Down Event on the Picture Control for LabVIEW 7.1 PocketPC PDA, I want to get the xy coordinates on where the user tapped on the pict control. Any ideas or workarounds? Robert

  • Cycling issue in DVD Menu

    I have the DVD Menu looping at 15 seconds. At the end of the 15 seconds, the button dissapears for like half a second and reapppears... I was wondering if there is a way to eliminate the choppiness as the DVD Menu recycles. Advice would be greatly ap