Submitting a user's file to an applet.

Hi,
I am fairly new to Java, but I have spent a large part of this year learning about and using Java to write a program for biochemists, to allow them to study a particular class of enzymes. I have used Java because I wanted to enable to program to be used by people via the internet, and I wanted there to be a good graphical interface. Java Applets have enabled me to do this. Furthermore, some of the computation has to be done via the server, because the Applet interfaces to a Prolog program, and again this was easy with Java, because I was able to do this using (HTTP interface) Servlets.
There is one major drawback to this solution. The users will often develop 'models' of their enzyme, which they will want to save to a file, and reload at a later stage. However, Applets cannot access the user's file system, which means I had to find another way to achieve this. At the moment, loading (and saving) the models is done in a two-step process. A form, embedded in the web page below the Applet, is used to submit the file to a Servlet, which saves the contents of the file to a session object. Then, the user clicks on a button in the Applet, which connects to another Servlet, and the file is read from the session object, and transmitted back to the Applet. Saving a file is just the reverse of this process.
Quite apart from the fact that it is a nuisance to do this transaction in two steps, it causes problems when the user doesn't have cookies turned on. I can always alert people to the fact that they need to turn cookies on (or use URL encoding), but it still means that there are two steps to the process.
Does anyone have any suggestions how I might be able to write this sequence so that the user can load or save a file in only one step, instead of two? Someone suggested that I use sockets, but from the reading that I have done, it seems that Servlets are simply a convenient way to use sockets. So, it seems using sockets would just be a more difficult and time-consuming way to achieve the same end.
Any suggestions on this topic would be gratefully appreciated.
Regards,
Sarah

Thanks so much for your prompt reply.
Every time the user performs an action in the applet that connects to one of the servlets, I extend the lifetime of their session object. That way, when they submit a file to the server, it is available for them to access it for a couple of hours, before the session object will time out (unless the user accesses the server in the meantime, which resets the lifetime of the session to 2hrs).
The problem isn't actually passing the file from the servlet to the applet (or vice versa) - I already use IO streams to do this. The problem is can I get the file from the HTML form to the applet in one step?
As far as I can see, if the connection to the servlet comes from the html form, then the response goes back to the browser. Similarly, if the request comes from the applet, the response goes back to the applet. What I am wondering is, is there a way to force communication from a servlet to the applet when the initial connection to the servlet has come from the browser (i.e. from the HTML form)?

Similar Messages

  • How to allow user upload file on applet??

    Sorry I'm new to programming here, but I'm trying to allow user to upload a file to the server so the program inside the server can user the file as input.
    I've noticed that JFileChooser, the ideal class for this, is not allowed on the applet, so I don't know how to go about doing this.
    Thanks for any input!

    ok
    you wish to transfer a file from applet to server.
    1. Applet gets the file
    the applet needs to access the file System therefor it must b a signed applet to get aound the security restrictions. This is why the JFileChooser doesn't work. Check out the tutorials on jars and applets, particularly the security notes.
    2. opens a connection with the server
    so the applet has a file and needs to send it. there needs to be a service of some form on the destination computer to execpt the file. Perhaps you write your own perhaps you use HTTP.
    3. server software stores the file
    where an applet is an mini application that runs within the confines of the web browser. a SERVLET is a service program which runs with in the confines of a server, such as a web server.
    this is a lot easier to do HTML rather that applet in my opinion but which ever.

  • I am working in windows 7 and I am trying to enable the copy/paste and I can not find user.j file in the profile and I am not real sure how to create a file, I can create a folder .

    I am trying to copy text from a word document and paste it into my web builder and it says that firefox does not support copy/paste from clipboard. Went to your site and it tells me to open the user.j file in my profile. This file does not exist and I am not real sure how to create that file so I can paste the fix from your site into it.

    I went to that link and added to firefox add on but it still does not work. I went to the add on option button for this but it told me that my MYSIWG widget was disabled. Does this have something to do with it not working and if so how do you enable it.

  • REP-0004: Warning: Unable to open user preference file.

    Hi,
    I am creating an invoice header in Payable through open interface in r12. I have inserted one line in  ap_invoices_interface table.
    When I run Payables Open Interface Import request, it completes normal but invoice does not create.
    Please see below log file and provide your guidence.
    Payables: Version : 12.0.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    APXIIMPT module: Payables Open Interface Import
    +---------------------------------------------------------------------------+
    Current system time is 24-DEC-2013 12:39:46
    +---------------------------------------------------------------------------+
    +-----------------------------
    | Starting concurrent program execution...
    +-----------------------------
    Arguments
    p_source='MANUAL INVOICE ENTRY'
    p_batch_name='test4'
    p_purge_flag='N'
    p_trace_switch='N'
    p_debug_switch='N'
    p_summary_flag='N'
    p_commit_batch_size='1000'
    p_user_id='19334'
    p_login_id='2499994'
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.AR8MSWIN1256
    Enter Password:
    REP-0004: Warning: Unable to open user preference file.
    MSG-00000: 0 invoice(s) were created during the process run
    MSG-00000: 0 invoice(s) were fetched during the process run
    MSG-00000:  summarize flagN
    MSG-00883: After Repport Trigger: Setting the Org Context to Multiple
    Report Builder: Release 10.1.2.3.0 - Production on Tue Dec 24 12:39:47 2013
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Regards
    Farooq

    Please also see if the following docs help.
    R12: Master Troubleshooting Guide for Supplier Contacts Open Interface Import Report (APXSCIMP) [Video] (Doc ID 1373699.1)
    R12: REP-0004 Error While Running Supplier Contacts Open Interface Import Program (APXSCIMP) (Doc ID 1195815.1)
    R12: APXSUIMP Ends With REP-0004 Error, But Output Does Not Display Reason for Rejection (Doc ID 1060824.1)
    Thanks,
    Hussein

  • How do I update a file in an Applet's JAR file from the Applet code

    Here's my problem.
    My applet is using a serializable history data in which I am storing in the applet's JAR file. When I run the applet, I read the file with "getResourceAsStream()" and run my program with that hist data. When my applet is closed, I need to update this file from my Applet's code and I dumfounded about how to do that.
    Is there any way to update a file in the Applet's JAR file through the Java Applet code? (i.e. OutputStream?).
    Would appreciate any advice people have.

    Just place a copy of the file on the local hard disk and update that. When you start the Applet you try to read from the hard disk. If the file exists then no problem otherwise copy it from the jar to the hard disk.

  • I was told to delete user.js file to stop viewing the "tour" page on start, file does not exist, problem remains

    i updated, i start firefox 2 tabs open one is "take the tour" tab the other is google, done the tour, a few times it opens up again every time, start of the healing process by typing in the question '"i keep seeing thr "take the tour"page on startup,then following the steps of the expertise i go to help,trouble blabla and i end up looking for user.js so i delete it or rename in a folder that contains folders and other data that nothing in there is like user.js file, so in the following question that is formed above there was no answer so i stepped into this case (only i had to create an account that was not my desire in the process) , thats all i know of.

    So, if you do not have the user.js file then you can rename or delete the prefs.js file (pref.js.sav) to see if that helps.<br />
    Windows likely hides the .js and shows them as User and Prefs.
    You can also try to delete the compatibility.ini file to force Firefox to reinitialize some other files.
    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • Reading and writing to a text file from an Applet

    I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
    However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
    Thanks,
    Andy
    import java.applet.Applet;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    public class test02 extends Applet {
    public Button B_go;
    public GridBagConstraints c;
    public void init() {
    this.setLayout(new GridBagLayout());
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    B_go = new Button("GO");
    c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
    c.weightx = c.weighty = 0.0;
    B_go.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    print_stuff();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.add(B_go,c);
    public static void print_stuff() {
    try{
    File f = new File("test02.txt");
    PrintWriter out = new PrintWriter(new FileWriter(f));
    out.print("This is test02.txt");
    out.close();
    }catch(IOException e){**/}
    }

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • How do I access my encrypted User Account files from my Back Up hard drive?  Time Machine  was used to create the back up disk; File Vault was used to encrypt the files.

    How do I access my encrypted User Account files from my Back Up hard drive?  Time Machine  was used to create the back up disk; File Vault was used to encrypt the files.

    Thanks.  I will try going through TM.  Since my Simpletech is on the way out, I'll be plugging in a new external hard drive (other than the back-up drive) and trying to restore the library to the new drive.  Any advice or warning if this is NOT the right thing to do?
    Meanwhile, that is a great tip to do an alternate back-up using a different means.  It's been tough to figure out how to "preserve access" to digital images and files for posterity, knowing the hardware will always fail/obsolesce sooner or later, and that "clouds" are only as good as their consistent and reliable accessibility.  Upping the odds with redundancy will help dull the edge of my "access anxiety", though logically, it can never relieve it.  Will look into
    Carbon Copy Cloner.

  • Garageband custom "user-loops" files missing

    I'm using Garageband '09 (Version 5.1 (398) and I am having trouble locating my custom "user loops" files.
    I know that custom made apple loops are saved in
    Library/Audio/Apple Loops/User Loops
    I have about 100 loops saved in the folder, but in Garageband I have over 200 saved custom made loops that work fine. I am able to use all of the loops, only about half of them have files in the correct place.
    Doing a spotlight search does not find anything, even when I search for the custom loop name exactly and search "This Mac" and "Library".
    One strange thing I've found is when viewing the loops browser, at the top there is a dropdown labeled "Loops" that offers the filters "My Loops" and "Shared Loops on my Mac". It seems that I can only find the files for "My Loops" and the "Shared Loops on my Mac" are the missing ones.
    Is there another place these files could be saved? I can use them in Garageband so they must be somewhere.

    How can I create loops that are "My Loops" vs "Shared Loops on my Mac" on purpose.
    Check your Preferences setting:
    In the "Loops" tab of the Preferences panel - the "My Apple Loops" option.
    If you share your loops with all users on your mac (users havg different accounts) then the loops will be installed in the System Library, but if you do not share, your loops will be installed in your user library. If you log in from a different account you will not be able to use them.
    Regards
    Léonie
    I don't have Logic installed, but both installation places should make it possible for Logic and MainStage to use the loops. It is the standard place where applications are looking for Apple Loops.

  • REP-0004 warning: Unable to open user preferance files

    Hi,
    I am new to R12. This is the upgradation project 11.5.1.2 to R12. we are newly installed the R12 application and 10g database.
    I am going to customize the standard report 'Printed Purchase Order Report', the rdf file is 'POXPRPOP'. but it is not getting any out put and xml tags also. even standard report also not getting any output and I noticed in logfile that the error like 'REP-0004 warning: Unable to open user preferance files'.
    I have tested in backend, its getting the data. then I have added command MO_GLOBAL.SET_POLICY_CONTEXT('S'.org_id) in before report trigger also. but getting same issue.
    Could you please help me wheather I need do any setups/modifications in RDF or Application. This is very urgency.
    Thanks in Advance.
    Regards,
    Thirupathi

    Hi Hussein,
    Thank you for your valuable response.
    I have followed the same steps for this customization what they are given in the metalink ID 374165.1.
    And one more thing, I am not getting any output if i ran the standard program 'Printed Purchase Order Report (Portrait)' in R12. what it could be the problem.
    Regards,
    Thirupathi

  • How to backup only users' relevant files from File History on Windows 8.1?

    Hi,
    I would like to find out how to backup certain user's files from File History on Windows 8.1?
    I'm planning to store the backup files on our server, over a shared network, so that client can retrieve them whenever they need.
    I manage to do one by excluding all the folders from c:\, but it occurs quite silly to me to go select one by one files to exclude them.
    Please advise if there is a better way?

    Hi,
    This IT Professional forum is for general questions, feedback, or anything else related to Office 2010, since your question is more related to Windows client, I'd recommend you post a new question in the following forum for further assistance:
    https://social.technet.microsoft.com/Forums/windows/en-US/home?category=w7itpro%2Cw8itpro%2Cwindowsvistaitpro%2Cwindowsxpitpro%2Cwindowsintune
    The reason why we recommend posting appropriately is you will get the most
    qualified pool
    of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Unable to generate users.xml file

    Hi All,
    I have installed OCS 10.1.2.0.0.and applied the cumulative patchset and now on OCS 10.1.2.3.0
    Now i am trying to migrate users and their mail box from exchange 5.5 running on Windows NT 4 server.
    I have installed the esmigration tool on a machine running Windows XP SP2, Outlook 2003 client installed. I ran the tool and successfully created the system profile. Once done when i try extract users which should generate a users.xml file, i get an error saying "Unable to generate users.xml" file. When i look at the log file i can see the error which says invalid domain which is not true. The domain name is right and i have repeated the process more than 10 times, but still keep getting the same error. I tried using IMPA to IMAP as well as with MBOX , but still the same error. Has anyone seen such a behavior ?
    So i tried to choose plan B. As i do not have too many users i decided to export the users mail box as a pst file and then import it. This is not a problem, but what i do not know is that what do i need to do to enable coexistence mode on exchange, meaning when an email arrives, it first goes to exchange and then forwards a copy to OCS.Please note on my research i have found some notes on how to do this on exchange 2000 on a windows 2000 server with AD, but i couldn't find anything for Exchange 5.5 on NT4.
    Any assistance on this would be very helpful.
    Regards,
    Dipak

    Hi Dipak,
    If you do the migration from the Windows 2000 machine with outlook 2000 installed, and connected to Exchange 5.5 via an admin profile, then you will not see this issue.
    In case, it is not possible for you to move to new machine where above said environment exists, then you can request for a patch of migration tool that has fix for this issue. Please send an email to [email protected] or [email protected], for the fixed version.
    For your co-existence query: Please make use of alternate-recipient setup that exists on exchange 5.5 user properties. So, the emails will be routed to both exchange, and ocs server mailboxes of that user.
    If you have any further queries please send an email to [email protected]
    Thanks,
    Venkat

  • How do I combine two user iPhoto files into one...keeps blocking the pics between users

    How do I combine two user iPhoto files into one...keeps blocking the pics between users on the same Mac?

    Put the library on an external hard drive that is formatted as shown in this screenshot:
    OT

  • Copy Function Doesn't Work After Updating user.js File

    I tried the Copy Function at the web site www.gogvo.com and got an error message from Firefox that Copy wasn't enabled. I got more info and created a user.js file in my Profile with the above site inserted following directions on the Troubleshooting Help page. I restarted Firefox but still can't use the Copy Function when I right-click a highlighted field to Copy. I have no problem when I use Internet Explorer 9 with my Windows 7 Home Premium. I have the latest version of Firefox. I have no problem copying on other sites, such as MSN Hotmail.

    I tried {Ctrl+C} and that doesn't work. I deleted the user.js file and downloaded the allowclipboard-helper file extension, and that doesn't work. I only have this Copy/Paste problem HERE: [http://www.gogvo.com/affiliates/optin_message.php GVO Responder Opt-in Message Edit] and don't have any Copy/Paste problems anywhere else. Is there another solution to try?

  • Add a jar file to an Applet

    Hi all,
    I'm trying to add a .jar file to my applet using the code:
    <applet name=myApplet.class archive=model.jar></applet>
    Both the .class and .jar files are in the same directory as test.html
    So, when the applet starts an exception is thrown:
    java.lang.NoClassDefFoundError: it/bizware/session/interfaces/HardwareLogManagerUtil
         at AppletPistolaL.getHardwareLogManager(AppletPistolaL.java:222)
         at AppletPistolaL.init(AppletPistolaL.java:97)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    The model.jar contains the path it/bizware/session.../HardwareLogManagerUtil!
    I can't understand why this exception is thrown
    Someone can help me?!?!?!
    thanks a lot!!

    Solved,
    just to add all path it/bizware/....
    and works!!!!
    bye!

Maybe you are looking for