Problems with reading information sent from a servlet to an applet

Ihave just created an applet and servlet. i want the servlet to send some data back to the applet so i can read it and just check to see whether the servlet has done the required job.
here is part of the applet and servlet code.
applet:
url = "http://localhost:8080/servlet/Option1Servlet?Firstname="+firstname.getText()
               +"&Lastname="+lastname.getText()+"&Staffstudentid="+staffstudentid.getText()
               +"&Position="+position.getText()+"&Email="+email.getText();
          Vector servletInfo = new Vector();
          ObjectInputStream inputFromServlet;
          try{
               String inputLine;
               System.out.println(url);
               URL urlocation = new URL(url);
               URLConnection uc = urlocation.openConnection();
               BufferedReader in = new BufferedReader(new InputStreamReader (uc.getInputStream()));
                    while((inputLine=in.readLine()) != null) {
                         servletInfo.add(inputLine);
               System.out.println("recieved info from servlet about ot process!");
               inputFromServlet = new ObjectInputStream(uc.getInputStream(checking));
               checking = (int)inputFromServlet.readInt();
               System.out.println(checking);
               in.close();
          catch(java.io.IOException ex) {ex.printStackTrace();}
          if (checking == 0) {
          Regcomplete f5 = new Regcomplete();
          f5.setSize(500,400);
               this.setVisible(false);
          f5.setVisible(true);
          else if (checking == 1) {
               firstname.setText("ERROR HAS OCCURED! CLICK CANCEL");
               lastname.setText("");
               staffstudentid.setText("");
               position.setText("");
               email.setText("");
servlet:
public void sendCheckingValue(HttpServletResponse res, int checking) {
          ObjectOutputStream outputToApplet;
          try {
               outputToApplet = new ObjectOutputStream(res.getOutputStream());
               System.out.println("Sending int to applet ... ");
               outputToApplet.writeInt(checking);
               outputToApplet.flush();
               outputToApplet.close();
               System.out.println("Data transmission complete.");
               System.out.println("Checking value sent = " + checking);
          catch (IOException e) { e.printStackTrace(); }
i get this exception when i run the code: this exception is thrown in the applet when it attempts to read the input data that has been sent:
C:\My Documents\logina>appletviewer Login.html
http://localhost:8080/servlet/Option1Servlet?Firstname=nnnnnnnnn&Lastname=nn&Sta
ffstudentid=99&Position=mm&Email=mm
recieved info from servlet about ot process!
java.io.StreamCorruptedException: Caught EOFException while reading the stream h
eader
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:845
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
at Option1.actionPerformed(Option1.java:252)
at java.awt.Button.processActionEvent(Button.java:329)
at java.awt.Button.processEvent(Button.java:302)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
can anyone help me please its urgent
thansk
fahad

can some one help me plz, its urgent, i get the error at this point in my code what am i doing wrong here.
inputFromServlet = new ObjectInputStream(uc.getInputStream());

Similar Messages

  • Problem with reading special char from file

    Hello Oracle community,
    Got a problem when reading from a file. I am using a croatian keyboard and trying to read special charachters (ČĆŽŠĐ) from a file.
    declare
      l_file utl_file.file_type;
      s varchar2(200);
    begin
      l_file := utl_file.fopen('test_dir', 'test.txt', 'R');
      loop
        utl_file.get_line(l_file, s);
        dbms_output.put_line(s);
      end loop;
    exception
      when no_data_found then
        utl_file.fclose(l_file);
    end;But I keep getting this in dbms_output: ČƎŠĐ. For some reason it keeps skipping 2 chars Š and Ž. If I try to insert or update data the values are show correctly. What could be the cause of such a problem?
    Best regards,
    Igor

    Hi Igor,
    Looks like a NLS_LANGUAGE issue. Check the following threads:
    UTL_FILE and NLS_LANG setting
    Re: Arabic characters not displaying in Forms
    Regards,
    Sujoy

  • Problems with opening attachments sent from Microsoft Outlook

    I have been using MacBook Pro and I have had problems with opening files from Microsoft Outlook.
    The attachments appear as .dat files (text, images etc..) and I am not able to open them.
    Does someone have any experience in solving this type of compatability problems on Mac OS ?

    Get this app or tell the sender to send the attachments using plain text for their emial:
    http://www.joshjacob.com/mac-development/tnef.php

  • Help with reading information coming from a software into LabVIEW through Serial port

    Hi,
    I am new to LabVIEW and also an amateur in using RS232 for communication. I have this software that has these icons like speed increase/decrease, elevation up/down, start/stop. Now, when I click these buttons on the software, they perform the appropriate functions. For example, if I press start button, the signal must go through a serial COM port into LabVIEW to start the machine. How do I do that? How do I find what format the code word is when I press a button on the software? And how to decode the information to read whether the button pushed is start etc...? Any help would be appreciated.

    I may not be perfect, but I'm all I got!

    That information would be in the programming manual for the device you're controlling. Unless you have a device that has no documentation or you cannot get the documentation that's the first place you should look. If you cannot get the documentation at all then you've got some reverse-engineering to do. To do this you will either need a serial port sniffer (a hardware device), or you can try to use a software-based port capturing program. On Windows PortMon is the most prevalent. This will show you how the port was configured (baud rate, stop bits, etc). Warning: the information is technical.
    As far as how to get it running in LabVIEW, you should take a look at the serial port communication examples that ship with LabVIEW. The most problems occur in figuring out how to (a) terminate a write command, and (b) determining when to stop reading. For (a) this is typically done by appending a carriage return or linefeed to the command. This is device dependent. For (b) this is usually done by the byte stream ending with a character like a linefeed. Again, this is device-dependent. 
    You may also want to peruse this KB article: Serial Instrument Control Tutorial. There are also lots of tutorial on the internet for basic tutorials on serial port communication.

  • Problem with reading file extensions from a Fat 32 Drive

    I have been copying image files from my imac 24" OSX 10.6.8 to a Maxxtor One touch external USB drive, the drive is FAT 32 format for a PC. My wife then connects the same drive to her laptop which is running Windows 7. She then sorts the images into different folder gives me back the drive to have more loaded to sort. The problem is when I get the drive back all the image files have a funny little box behind the file extension and the preview icon is blank with a exe in green, the file info says it's a Unix extension.
    I tried to remove the little box and open the .tif file or .jpg files and all I get is a image is not readable. The same drive can be mounted back to my wife's laptop and the images open up just fine in Windows media viewer.
    What's going on here and how do I fix and prevent this from happening again?
    Thanks!
    Pat

    So No one has any ideas on how this is happening and how to go about repairing the problem.
    The trouble as I see it comes up once she moves the files into another folder on Maxxtor drive when it's hooked up to the Win 7 laptoop. The Data then is unuseable on my Mac from that point on.
    I need to know WHY so I can aviod this from happening again, and how to fix currently there is 250 GB of image files I can not access on my Mac and I still have about 2 TB of image files to go through, and THEY ALL NEED TO BE ACCESSABLE.
    Anybody?

  • Problem with reading mpeg files from Sony DCR-SR100 30GB Handycam

    I just purchased a new Sony DCR-SR100 Handycam.
    I can upload successfully to my desktop (PowerBook G4)via a USB cable.
    I have all the latest updates for iLife, iMovie, Final Cut Pro and Quicktime. None of those applications will open the imported mpeg.
    When trying to import the file to the iMovie application I get the following error message:
    "The file could not be imported. The file M2UOOOO4.MPG can't be imported; Quicktime couldn't parse it: -2048"
    Any help would be greatly appreciated.
    igor4443

    Hi Igor,
    welcome to the  board
    ... hm, sorry to say, but:
    iMovie is a video edit app meant to work with firewire connected miniDV camcorders
    you try to teach the old dog new tricks... just one kind of mpegs can be handled with iM, that is mp4, imported via iPhoto6 (some stillcams can record a kind of "movin' images"...)
    sooo, you need to convert your stuff...
    mpegs are meant for playback only, they are a delivery format (thanks, Lennart, for this phrase).. editing/processing such files, needs to demuxx them => 3rd party tools...
    there's a very good and free solution:
    Streamclip (free)
    not using a miniDV camcorder, you miss the convenience of the iApps...

  • Problem with reading config file

    Hello,
    I have problem with reading config file from the same dir as class is. Situation is:
    I have servlet which working with DB, and in confing file (config.pirms) are all info about connection (drivers, users, passw, etc.). Everything work fine if I hardcoded like:
    configFileName = "C:\\config.pirms";I need to avoid such hardcoding, I tryied to use:
    configFileName = Pirms.class.getClassLoader().getResourceAsStream ("/prj/config.pirms").toString();but it isn't work.
    My config file is in the same directory as Pirms.class (C:\apache-tomcat-5.5.17\webapps\ROOT\WEB-INF\classes\prj)
    Also I tryied BundledResources, it isn't work fo me also.
    Can anybody help me to solve this problem? with any examples or other stuff?
    Thanks in advance.
    Andrew

    Thanks, but I am getting error that "non-static method getServletConfig() cannot be referenced from a static context"
    Maybe is it possibility to use <init-param> into web.xml file like:
    <init-param>
      <param-name>configFile</param-name>
      <param-value>/prj/config.pirms</param-value>
    </init-param>If yes can anybody explain how to do that?
    I need to have that file for:
    FileReader readFile = new FileReader(configFile);Thanks in advance.

  • I am facing a Problem with reading images from database

    Hi everybody..
    any help will be most appreciated, I am facing problem with reading images from database. I am pasting my code... 
                    string connect = "datasource = localhost; port = 3306; username = root; password = ;"; 
                    MySqlConnection conn = new MySqlConnection(connect); // creating connecting string
                    MySqlCommand sda = new MySqlCommand(@"select * from management.add_products ", conn); //creating query
                    MySqlDataReader reader; 
                    try
                        conn.Open(); // Opening Connection
                        reader = sda.ExecuteReader(); // Executing my Query..
                        while (reader.Read())
                            byte[] imgg = (byte[])(reader["Picture"]);
                            if (imgg == null)
                                pc1.Image = null;
                            else
                                MemoryStream mstream = new MemoryStream(imgg);
                                pc1.Image = System.Drawing.Image.FromStream(mstream);
    It says Parameter not Valid... i am reading all the images from database

    I agree with Viorel. You are getting the error because the format of the data is incorrect probably because the data was modify. It may not be the reading of the database the is incorrect, but the application that wrote the data into the database. You need
    to compare the imgg array data with the data before it was written to the database to see if the data matches.  I usually start by comparing the number of bytes which is easier to check then compare the actual to isolate which function is changing the
    byte count.
    An image is binary data.  The standard VS methods for reading and writing data (usually stream classes) default to ASCII encoding which will corrupt binary data.  The solution usually is to use UTF8 encoding instead of the default ascii encoding. 
    Ascii encoding with stream often aligns the data and adds extra null bytes to the end of the data which can produce these type errors.
    jdweng

  • I just started using my iphone 5s. I have a problem with new incoming emails from my POP account. Why are they marked as read automatically even though I have not even opened them yet.

    I just started using my iphone 5s. I have a problem with new incoming emails from my POP account. Why are they marked as read automatically even though I have not even opened them yet.
    At first I thought it might be because I was using simultaneously my old iPhone 4S so it somehow realized the emails where being pushed to another device and the it marked as read, this has nothing to do since I have deleted the email account from the iPhone 4S

    Contact the email provider for assistance with their service.

  • Problem in retriving the realpath from the servlet

    Hai All,
    I am facing problem in retriving the realpath from the servlet.
    I am using the following code in order to retrieve the path.
    String prefix = getServletContext().getRealPath("/WEB-INF/classes");
    The value returned from above code is null.
    I am using Weblogic 8.1 server, and deploying my servlet as WAR file inside
    the weblogic server.
    Is this the problem with the weblogic server or with the code. Is there any way to over come this.
    I need the path as i am implementing Log4j for the servlet and i have to pass the
    configuration file in one of the function "PropertyConfigurator.configure(file);"
    where the file should include complete path.
    My configuration file is in WEB-INF/Classes directory.
    Any help is appreciated.
    Thanks in advance
    Pooja.

    String realPath = request.getRealPath(request.getContextPath());
    That should return the path up to where you have your servlet context.

  • Hello I have a problem with facebook Messenger disappeared from my desktop iPod in the AppStore it says "open" does not respond when I press it. What should I do to download it? But I do not have it in AppStore it says that I have it: (

    Hello I have a problem with facebook Messenger disappeared from my desktop iPod in the AppStore it says "open" does not respond when I press it. What should I do to download it? But I do not have it in AppStore it says that I have it: (

    - Go to Settings>General>Usage>Storage>and under apps select FBM and try to delete it.
    Next:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       

  • Problems with importing text messages from PC Suit...

    Problems with importing text messages from PC Suit 7.1.18.0 to my Nokia 5800
     I am trying to import a csv file that contains text messages (Note that this file was created using PC Suit 7.1.18.0) to a subfolder that I have created to My Folders but PC Suits only imports the text messages to the Draft folder. Note that initially it shows that the messages are import in the correct folder but after a refresh it shows them in the Draft Folder. Is their any setting that I should change in the PC Suit or the phone? My computer runs on Windows XP Service Pack 3 and the Nokia 5800 was upgraded to the latest firmware v20.0.012
     Thanks for your help

    Most phones only allows importing of draft and archived box for SMS.
    To do a restoring, you need to backup the SMS as a .nbu file using PC Suite and restore later.
    If you got an SD card, you can also do a backup on the SD Card (backup.arc) then restore later (reset and restore: backup.arc and mmc).
    What's the law of the jungle?

  • Problem with READ Statement in the field routine of the Transformation

    Hi,
    I have problem with read statement with binary search in the field routine of the transformation.
    read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
    1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
    2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
    Code in the start routine
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
         and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp <> 3.
    delete it_zcam where end_dt initial.
    sort it_zcam by surce accno.
    endif.
    field routine code:
    read table it_zcam with key source = source_package-source
                                                 accno  = source_package-accno
                                                 binary search
                                                 transportin no fields.
    if sy-subrc = 0.
    RESULT  = 'Y'.
    else.
    RESULT = 'N'.
    endif.
    this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
    the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
    this field i am using in the report filter.
    please let me know if anybody has the soluton or reason for this strage behaviour.
    thanks,
    Rahim.

    i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
    1. is the key of zcam_o11 source and accno ?
    2. you need to get the sortout of if endif (see code below)
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
    and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp 3.
    delete it_zcam where end_dt initial.
    endif.
    sort it_zcam by surce accno.
    field routine code:
    read table it_zcam with key source = source_package-source
    accno = source_package-accno
    binary search
    transportin no fields.
    if sy-subrc = 0.
    RESULT = 'Y'.
    else.
    RESULT = 'N'.
    endif.

  • Cisco ASA 5505 - problem with negotiating IP address from PPPoE

    Hi all,
    I have problem with negotiating IP address from PPPoE. There is following design: ISP providing vDSL ending on VDSL modem in bridge mode. Behind brigde modem is ASA 5505 terminting PPPoE on OUTSIDE. Everything works fine except  negotiating IP address from PPPoE server.
    I have configured ASA 5505 with (ASA Version 9.2(2)4) for PPPoE like this [1.]. But If i try to "show" IP address on OUTSIDE interface a get this [2.], ok strange but let's continue. If list "show vpdn pppinterface id 1"  i get this [3.]. Seems that I got public IP addres what was right, but this IP address was not associated with interface OUTSIDE?
    Well, if I set IP address manually like this [4.] and also set a default route everything works fine but what will happen when ISP change reservation for my IP address or default gateway. 
    I have tried different version of ASA OS like 8.4, 9.1 but without luck. 
    Can anybody help me. Thanks a lot.
    Regards
    Karel
    [1.]
    interface Vlan100
    description >>VLAN pro pripojeni do internetu<<
    nameif OUTSIDE
    security-level 0
    pppoe client vpdn group O2
    ip address pppoe setroute
    vpdn group O2 request dialout pppoe
    vpdn group O2 localname O2
    vpdn group O2 ppp authentication chap
    vpdn username O2 password *****
    interface Ethernet0/0
    description >>uplink O2 vDSL<<
    switchport access vlan 100
    [2.]
    ciscoasa(config-if)# show ip address vlan 100 pppoe
    ciscoasa(config-if)#  0.0.0.0 255.255.255.255 on Interface: OUTSIDE
    ciscoasa(config-if)# show interface vlan 100 detail
    Interface Vlan2 "OUTSIDE", is up, line protocol is up
     Hardware is EtherSVI, BW 100 Mbps, DLY 100 usec
            Description: >>VLAN pro pripojeni do internetu<<
            MAC address f44e.05d0.6c17, MTU 1492
            IP address unassigned
      Traffic Statistics for "OUTSIDE":
            28 packets input, 1307 bytes
            31 packets output, 721 bytes
            0 packets dropped
          1 minute input rate 0 pkts/sec,  3 bytes/sec
          1 minute output rate 0 pkts/sec,  1 bytes/sec
          1 minute drop rate, 0 pkts/sec
          5 minute input rate 0 pkts/sec,  0 bytes/sec
          5 minute output rate 0 pkts/sec,  0 bytes/sec
          5 minute drop rate, 0 pkts/sec
      Control Point Interface States:
            Interface number is 15
            Interface config status is active
            Interface state is active
    [3.]
    ciscoasa(config-if)# show vpdn pppinterface id 1
    PPP virtual interface id = 1
    PPP authentication protocol is CHAP
    Server ip address is 88.103.200.41
    Our ip address is 85.71.188.158
    Transmitted Pkts: 20, Received Pkts: 16, Error Pkts: 0
    MPPE key strength is None
      MPPE_Encrypt_Pkts: 0,  MPPE_Encrypt_Bytes: 0
      MPPE_Decrypt_Pkts: 0,  MPPE_Decrypt_Bytes: 0
      Rcvd_Out_Of_Seq_MPPE_Pkts: 0
    ciscoasa(config-if)# show vpdn session state
    %No active L2TP tunnels
    %No active PPTP tunnels
    PPPoE Session Information (Total tunnels=1 sessions=1)
    SessID TunID Intf     State       Last Chg
    22298      2 OUTSIDE  SESSION_UP  561 secs
    [4.]
    interface Vlan100
     description >>VLAN pro pripojeni do internetu<<
     nameif OUTSIDE
     security-level 0
     pppoe client vpdn group O2
     ip address 85.71.188.158 255.255.255.255 pppoe setroute
     route OUTSIDE 0.0.0.0 0.0.0.0 88.103.200.41 1

    You're right that the ACL should not affect otherwise allowed communications to the interface address.
    Try disabling the ip audit feature on your outside interface.
    no ip audit interface OUTSIDE AP_OUTSIDE_INFO
    no ip audit interface OUTSIDE AP_OUTSIDE_ATTACK

  • After update 8.1.2 i had problem with sync my content from ITunes with IPod

    After update 8.1.2 i had problem with sync my content from ITunes with IPod. It stucks on moment when its waiting for implementing changes (step 5 of 5) Hours and hours i'm waiting but still the same. So i cant use my Ipod at all. I restarted Ipod and delete and download Itunes again. Still stuck in the same moment. Help please. Someone has some problems like that?

    I have an error message saying that "An unknown error occurred (-54)"

Maybe you are looking for

  • Accessing APEX from E-Business Suite 11.5.10

    Hi All - I am brand new to APEX and have basically inherited the program duties b/c the school district that I work for had to cut costs and therefore had to let our consultants go - which means that I need to manage the system with no knowledge.....

  • Importing material from Bridge to AE (beginner)

    In a recent AE tutorial I was enjoying, I was prompted to go to animation and browse presets to try them out, which launches Bridge.  When I double clicked the preset I wished to use, AE displayed a message:  After Effects error:  Can't import file,

  • Cannot ping ibook with multiple admin accounts

    i am trying to set up remote control across a LAN, and have had success with two iMac G5's controlled from my dual G5. the problem is that i can't connect to an iBook with exactly the same settings and firewall config. in trying to troubleshoot, i ha

  • Prob. in a report

    Hi, I m stuck in a probelem while creating a repot for Oracle Financials. I created a report of which there are diffrent parameters and one of the parameter is Set_of_book_id .Now I want dat dis parameter shud automatically get its value as the parti

  • Why does the audiobook sound like its in an echo chamber?

    I've been downloading books from Overdrive Media successfully but now when I do it, the audio sounds as if its in an echo booth. They are WMA audiobooks that I download and then transfer to itunes as recommended. What is happening?