JAVA ASSISTANCE NEEDED IN DOING FIRST APPLET !

Dear People,
Every time I try to clean up the errors,
I start a new project and the JBuilder gives each
new project a new name of course but it also carries over
the error messages from the previous project to the new
applet so trying to clean up the error messages is a
frustrating process.
The improved coding is below and the remaining messages
Thank you for your advice
Stan
package stan_event_makebox;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import objectdraw.*; //imported library
public class myApplet extends Applet {
private boolean isStandalone = false;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
//Construct the applet
public myApplet()
// Here is the coding that I need to put into the applet template.
// Change text color depending on whether mouse
// is up or down
public class MouseIndicator extends WindowController
private Text up, down;
public void begin()
up = new Text("UP",200,220,canvas);
down = new Text("DOWN",200,200,canvas);
up.setColor(Color.red);
down.setColor(Color.gray);
public void onMousePress(Location point)
down.setColor(Color.red);
up.setColor(Color.gray);
public void onMouseRelease(Location point)
up.setColor(Color.red);
down.setColor(Color.gray);
//Initialize the applet
public void init() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
//Get parameter info
public String[][] getParameterInfo() {
return null;
//Here are the error messages (its a mess)
"Applet3.java": Error #: 204 : illegal start of expression at line 23, column 2
"Applet3.java": Error #: 207 : not an expression statement at line 17, column 11
"Applet3.java": Error #: 202 : 'class' or 'interface' expected at line 54, column 11
"Applet2.java": Error #: 204 : illegal start of expression at line 25, column 2
"Applet2.java": Error #: 207 : not an expression statement at line 16, column 10
"Applet2.java": Error #: 204 : illegal start of expression at line 26, column 2
"Applet2.java": Error #: 206 : malformed expression at line 25, column 2
"Applet2.java": Error #: 204 : illegal start of expression at line 28, column 2
"Applet2.java": Error #: 206 : malformed expression at line 26, column 2
"Applet1.java": Error #: 204 : illegal start of expression at line 23, column 2
"Applet1.java": Error #: 207 : not an expression statement at line 17, column 11
"Applet1.java": Error #: 202 : 'class' or 'interface' expected at line 54, column 11
"Applet1.java": Error #: 202 : 'class' or 'interface' expected at line 75, column 1
"myApplet.java": Error #: 204 : illegal start of expression at line 21, column 1
"myApplet.java": Error #: 207 : not an expression statement at line 16, column 10

If you code it yourself, instead of using some massively complexifying IDE, you could probably do it in about 20-30 lines. Heck, I'll do it right here (but watch out for typos, I'm notorious for them):
import java.awt.*;
import java.awt.event.*;
public class ColorChanger
extends java.applet.Applet
    private Color upC = Color.red;
    private Color downC = Color.blue;
    private Label text = new Label("No input yet");
    private String upT = "UP";
    private String downT = "DOWN";
    public ColorChanger()
        add(text);
        text.setSize(text.getPreferredSize());
        text.addMouseListener(
            new MouseAdapter()
                public void mousePressed(MouseEvent me)
                    text.setText(downT);
                    text.setForegroundColor(downC);
                public void mouseReleased(MouseEvent me)
                    text.setText(upT);
                    text.setForegroundColor(upC);
}The ony reason I did that for you is because I hate IDEs!
-Tim
P.S. No guarantees on whether or not it works. I didn't bother to look up the correct method names...

Similar Messages

  • Learning java - assistance needed

    Good morning everyone!
    I've been beating my head against the table trying to figure out what I'm doing wrong here, and my wife pointed out that I should maybe..I dunno, ask for help?
    Here's the situation:
    I'm designing a cell phone keypad with a text field above and a separate clear button to the right of the 12 button keypad. Buttons 1-0, and * and #.
    Heres the first of two problems:
    My GridLayout is propagating as a FlowLayout I think, either that or it's just ignoring me altogether.
    I need to know what mistake I'm making, but the three manuals I've been going through aren't helping me much.
    Here's the second and final problem:
    My button pressing escapades are having no impact on my textfield. This is definitely a case of can't see the forest for the trees. I know it's an obvious mistake, but I'm getting a bit frustrated so I'm missing it.
    And here's my code below, if there are optimizations possible, my pride will not be hurt if you suggest them.
    Thank you for your time folks, and thanks for all the assistance you've unknowingly given me before.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class KeyPadTwo extends JPanel
         JTextField numbers;
         JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0, ba, bb, clear;
         JPanel textPanel, clearPanel, buttonPanel;
         public KeyPadTwo ()
              JPanel contentPane = new JPanel(new BorderLayout());
              JPanel textPanel = new JPanel();
              textPanel.setLayout(new BorderLayout());
              JTextField numbers = new JTextField(20);
              add(numbers);
              contentPane.add(textPanel, BorderLayout.NORTH);
              JPanel buttonPanel = new JPanel(new GridLayout(3,3));
              buttonPanel.setBackground (Color.darkGray);
              JButton b1 = new JButton("1");
              JButton b2 = new JButton("2");
              JButton b3 = new JButton("3");
              JButton b4 = new JButton("4");
              JButton b5 = new JButton("5");
              JButton b6 = new JButton("6");
              JButton b7 = new JButton("7");
              JButton b8 = new JButton("8");
              JButton b9 = new JButton("9");
              JButton b0 = new JButton("0");
              JButton ba = new JButton("*");
              JButton bb = new JButton("#");
              add(b1);
              add(b2);
              add(b3);
              add(b5);
              add(b6);
              add(b7);
              add(b8);
              add(b9);
              add(b0);
              add(ba);
              add(bb);
              ButtonListener digitListener = new ButtonListener();
              b1.addActionListener (digitListener);
              b2.addActionListener (digitListener);
              b3.addActionListener (digitListener);
              b5.addActionListener (digitListener);
              b6.addActionListener (digitListener);
              b7.addActionListener (digitListener);
              b8.addActionListener (digitListener);
              b9.addActionListener (digitListener);
              b0.addActionListener (digitListener);
              ba.addActionListener (digitListener);
              bb.addActionListener (digitListener);
              contentPane.add(buttonPanel, BorderLayout.CENTER);
              JPanel clearPanel = new JPanel(new GridLayout(0,1));          
              JButton clear = new JButton("C");
              add(clear);
              ClearListener clearListener = new ClearListener();
              clear.addActionListener(clearListener);
              contentPane.add(clearPanel, BorderLayout.EAST);
          private class ButtonListener implements ActionListener
              public void actionPerformed(ActionEvent e)
                   Object source = e.getSource();
                   String result;
                   result = "";
                   if(source == b1)
                        result = numbers + "1";
                   else if (source == b2)
                        result = numbers + "2";
                   else if (source == b3)
                        result = numbers + "3";
                   else if (source == b4)
                        result = numbers + "4";
                   else if (source == b5)
                        result = numbers + "5";
                   else if (source == b6)
                        result = numbers + "6";
                   else if (source == b7)
                        result = numbers + "7";
                   else if (source == b8)
                        result = numbers + "8";
                   else if (source == b9)
                        result = numbers + "9";
                   else if (source == b0)
                        result = numbers + "0";
                   else if (source == ba)
                        result = numbers + "#";
                   else if (source == bb)
                        result = numbers + "*";
          private class ClearListener implements ActionListener
              public void actionPerformed(ActionEvent c)
                   numbers.setText(" ");
         public static void main(String[] args) {
            JFrame frame = new JFrame("KeyPad Demo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          KeyPadTwo kp = new KeyPadTwo();
              frame.getContentPane().setLayout(new BorderLayout());
              frame.getContentPane().add(kp, BorderLayout.CENTER);
          frame.setSize(250, 200);
          frame.setVisible(true);
         

    Onker wrote:
    Am I adding the buttons incorrectly? I've never done nested panels for an assignment before, at least not with multiple layout types.The best way I've found to test complex layouts is to test each component in isolation. For instance if I wanted to test a gridlayout, I'd create a small app that creates nothing but this:
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class MainPanel extends JPanel
      private String[] btnStrings =
        "A", "B", "C", "D", "E", "F", "G", "H", "I", "*", "Z", "#"
      private JPanel buttonPanel = new JPanel();
      public MainPanel()
        buttonPanel.setLayout(new GridLayout(0, 3));
        ButtonListener buttonlistener = new ButtonListener();
        for (int i = 0; i < btnStrings.length; i++)
          JButton button = new JButton(btnStrings);
    button.addActionListener(buttonlistener);
    buttonPanel.add(button);
    this.add(buttonPanel); // this is redundant here, but placed here to impress that buttonPanel must be added to the MainPanel to be seen
    private class ButtonListener implements ActionListener
    public void actionPerformed(ActionEvent e)
    String btnString = e.getActionCommand();
    System.out.println("Button pressed: " + btnString);
    private static void createAndShowUI()
    JFrame frame = new JFrame("ButtonPanel");
    frame.getContentPane().add(new MainPanel());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    public static void main(String[] args)
    java.awt.EventQueue.invokeLater(new Runnable()
    public void run()
    createAndShowUI();
    And then when working, I'd incorporate it into the greater program.
    Edited by: Encephalopathic on Jun 22, 2008 10:57 AM

  • Help needed in doing a first applet !

    Dear People,
    My goals are humble. Only to do a first applet
    my MyFirstApplet.html and MyFirstApplet.java are below
    If I try to open the html document in the web browser
    I see a grey rectangle which indicates I think that
    the applet capability has not been enabled for the browser.
    Yet I did download the plugin .
    thank you in advance
    Stan
    import javax.swing.JApplet;
    import java.awt.Graphics;
    public classMyFirstApplet extends JApplet
    public void paint(Graphics g)
    g.drawString("To climb a ladder, start at the bottom rung",20,90);
    <html>
    <head>
    <title> MyFirstApplet
    </title>
    <body>
    <applet code = "MyFirstApplet.class" width = 300 height = 200 >
    </applet>
    </body>
    </html>

    I would try to color the background to see if it is even getting addd to the applet.
    import javax.swing.JApplet;
    import java.awt.Graphics;
    public classMyFirstApplet extends JApplet
    punlic void init(){
    this.setSize(300,300);//setst the size
    this.setbackground(Color.red);//sets the color of the background
    public void paint(Graphics g)
    g.setForeground(Color.black);//sets the color of the text
    g.drawString("To climb a ladder, start at the bottom rung",20,90);
    thy that and let me know if it worked,.
    steve

  • How can i format my macbook 10.5.8 to snow leopord i am doing first time  format how its process and do i need to formet or upgrade and i have a snow leopard DVD????

    how can i format my macbook 10.5.8 to snow leopord i am doing first time  format how its process and do i need to formet or upgrade and i have a snow leopard DVD???

    First, I'd advise you to make a backup. Time Machine is fine, but I recommend making a bootable backup with Carbon Copy Cloner if possible.
    Then, insert the Snow Leopard DVD (it's a retail version, right? Not a grey disk meant for another machine?) and run the installer on the disk. Should be automatic from that point in. You don't need to reformat your drive.
    Matt

  • Help Needed in doing my second Applet ! ! !

    Dear People,
    I successfully did my first applet. The second applet is more challenging. Your advice is appreciated. Here is what I have done so far:
    1) downloaded the newest j2sdk1.4.0_01
    2) downloaded the newest jre plugin 1.4.1_01
    3) downloaded the newest Windows Explorer
    4) created a batch file to use the java path
    5) saved the batch file javacompile.bat
    6) downloaded the objectdraw library from
    http://applecore.cs.williams.edu/~cs134/eof/library/javadocs/
    7) ran the batch file:
    C:\> javacompile C:\WINDOWS\jbproject\MakeBox.java
    The error messages say:
    . (first error message not visible)
    import objectdraw.*;
    ^
    C:\WINDOWS\jbproject\MakeBox.java:7: cannot resolve symbol
    symbol : class WIndowController
    location: class MakeBox
    public class MakeBox extends WindowController
    ^
    C:\WINDOWS\jbproject\MakeBox.java:9: cannot resolve symbol
    symbol : class location
    location: class MakeBox
    public void onMousePress(Location point)
    ^
    C:\WINDOWS\jbproject\MakeBox.java:11: cannot resolve symbol
    symbol : class FilledRect
    location: class MakeBox
    new FilledRect(40,80,30,20,canvas);
    ^
    C:\WINDOWS\jbproject\MakeBox.java:11: cannot resolve symbol
    symbol : variable canvas
    location: class MakeBox
    new FilledRect(40,80,30,20,canvas);
    ^
    5 errors
    here is the .java and .html files
    //sample program
    //draw filled rectangle when mouse is pressed
    import objectdraw.*;
    import java.awt.*;
    public class MakeBox extends WindowController
    public void onMousePress(Location point)
    new FilledRect(40,80,30,20,canvas);
    <html>
    <head>
    <title> Make Box
    </title>
    <body>
    <applet
    codeBase = "."
    code = "MakeBox.class" width = 300 height = 200 >
    </applet>
    </body>
    </html>
    Thank you in advance
    Stan

    Dear Sooty70,
    I added to my batch file to the path as you suggested. Here is what my batch file looks like now:
    rem set my Command.com to uset he java path
    echo off
    cls
    C:
    cd\
    PATH=C:\j2sdk1.4.0_01;C:\j2sdk1.4.0_01\bin;C:\jsdk1.4.0_01\lib;C:\WINDOWS\jbproject\objectdraw.jar
    javac %1
    I still get the same error messates when I go to the Dos prompt and say
    C:\> javacompile C:\WINDOWS\jbproject\MakeBox.java
    Thank you in advance
    Stan

  • Image size and mime type.. non-java guy needs help

    Image size, mime type.. non-java guy needs help
    Im not at all familiar with java so this is really weird for me to work out. I?ve been doing it all day (and half of yesterday).
    Im trying to write a custom clodFusion tag in java that gets the width, height, size and MIME types of a given file. I?ve been trying to get it to work on the command line first. I can get the width and height but cant get the size and the MIME type.
    Here is what I got
    /*import com.allaire.cfx.*;*/
    import java.awt.image.renderable.*;
    import javax.media.jai.*;
    import com.sun.media.jai.codec.*;
    import java.io.*;
    import java.util.*;
    public class ImageInfo {
    private RenderedOp image = null;
    private RenderedOp result = null;
    private int height = 0;
    private int width = 0;
    private String type = "";
    private String size = "";
    public void loadf(String file) throws IOException
    file = "80by80.jpg";
    FileSeekableStream fss = new FileSeekableStream(file);
    image = JAI.create("stream", fss);
    height = image.getHeight();
    width = image.getWidth();
    System.out.println(height + "\n");
    System.out.println(width);
    System.out.println(type);
    public static void main(String[] args) throws IOException {
    ImageInfo test = new ImageInfo();
    test.loadf(args[0]);
    can anyone please help me out to modify the above so I can also print the mime type and the file size to screen.
    thanks for any help

    any suggestions?

  • How to pass first applet value to second applet

    please help ,
    can anyone knows how to send first applet parameter to second applet,
    here is the code
    //<applet code="firstapplet.class" height="200" width="300"></applet>
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class firstapplet extends JApplet
    JPanel pn;JTextField txt;JButton btn;
    public void init()
    pn = new JPanel();
    getContentPane().add(pn);
    txt = new JTextField(20);
    pn.add(txt);
    btn = new JButton("submit");
    pn.add(btn);
    on the click of button i want to pass the textfield value to second applet

    I don't know what exactly you mean by "sending first
    parameter", but using Applet.getContext() you can
    gain access to the other applets on that page, if
    that's what you need. Refer to the API docs for more
    info.thanks for the reply,
    but i want to get the first applet textfield value and show on second applet
    can you help me on this

  • Assistant needs access to boss's calendar on Exchange on her iphone

    I have a dilemma.
    The assistant already has access to her boss's calendar on her Outlook 2007 on Exchange 2010. But not on her iphone. She has her calendar but cannot get to her boss's calendar.  How can I make this work?
    We are using Air-Watch MDM to enroll and manage the iPhones.
    Thanks,

    We are also using AirWatch in my company and have been asked a similar question for some assistants.  Let me first state that while it is possible - there are numerous cautions to doing this!
    If the assistant's phone is properly enrolled and they receive their data from Exchange, you can manually create another Exchange account on their iPhone for their manager and select what deliverables they would like to sync. AirWatch's SEG (Secure Email Gateway) will use the compliance of her/his iPhone to passthrough to Exchange any valid account on that device.  Unlike Outlook/Exchange - there is no view only for the assistant, they will have full control of that mailbox - this gets confusing with things like calendar - because they will get notifications for both meetings and the pop-ups do not indicate which account they are for.  (there is some setting changes you can make to set the assistants calendar as the default, but I have not seen notifications on/off per calendar account - only the calendar as a whole).
    When we tested this, we are not using certificates to sync the passwords (that's another discussion), so everytime the manager changes their AD password (which we sync with their Outlook password), they would have to go and manually change it on the assistants phone.
    In short - it is possible to have multiple accounts on an enrolled device, but the additional ones will need to be manually created (since the EAS payload pulls the Enrolled Information from the AirWatch agent for email setup), they will have full access to that mail account and can get confusing on the calendar side.

  • First Applet

    Hello
    I just started a Java programming class and this is my first post
    I tried running this Applet from our book but get the error "java.lang.NoSuchMethodError:
    main Exception in thread "main".
    // Fig. 3.9: WelcomeApplet2.java
    // Displaying multiple strings in an applet.
    // Java packages
    import java.awt.Graphics; // import class Graphics
    import javax.swing.JApplet; // import class JApplet
    public class WelcomeApplet2 extends JApplet {
    // draw text on applet�s background
    public void paint( Graphics g )
    // call superclass version of method paint
    super.paint( g );
    // draw two Strings at different locations
    g.drawString( "Welcome to", 25, 25 );
    g.drawString( "Java Programming!", 25, 40 );
    } // end method paint
    } // end class WelcomeApplet2
    The book talks about needing an applet viewer which it has in the book cd. I didn't wish
    to install the sdk from the book as it wants to unload the version already installed. So my
    programs may uninstall with it. But nonetheless the error persists.
    Any ideas?
    Steve Brock

    Hi
    I'm not 100% sure whether that what you wanted but anyway ill show it to you :)
    // Fig. 3.9: WelcomeApplet2.java
    // Displaying multiple strings in an applet.
    // Java packages
    import java.awt.Graphics; // import class Graphics
    import javax.swing.JApplet; // import class JApplet
    import javax.swing.*;
    import java.awt.*;
    public class WelcomeApplet2 extends JApplet
    JFrame frame = new JFrame(); //creating a Frame so you can use paint()
    // to learn more about this go to java tutorials Swing
    public void createFrame()
    JFrame.setDefaultLookAndFeelDecorated(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setupFrame(frame.getContentPane());
    frame.pack();
    frame.setSize(100,100);
    frame.setVisible(true);
    public void setupFrame(Container pane)
    pane.add(new Panel());
    public class Panel extends JPanel
    // draw text on appletys background
    public void paint( Graphics g )
    // call superclass version of method paint
    // super.paint( g );
    // draw two Strings at different locations
    g.drawString( "Welcome to", 25, 25 );
    g.drawString( "Java Programming!", 25, 40 );
    public static void main(String[] args) // always in java code
    WelcomeApplet2 newObj = new WelcomeApplet2(); //creating an instance of this class
    newObj.createFrame();
    ok this code will work... and yours wasn't because you have to have main method, because after you have compiled your code, JVM searches class for this method to execute the program.

  • I was trying to put my password but it is not working. My Ipod touch is showing "Ipod is disabled, connect to Itunes". But I tried to connect but the Itunes tells me that I need the password first to connect.I do not know the password. what should I do?

    I put the password in my Ipod and now I am trying to put it again but it is not working....I tried to connect with the Itunes and it is not working because to the Itunes work with my Ipod, I need the password first, which I do not know. In my Ipod is showing "Ipod is disable, connect to Itunes". I was trying to connect but I can't...what should I do ?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                          
    If recovery mode does not work try DFU mode.                         
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings         
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Error: The Java Runtime in use does not contain a suitable JAXP feature

    Hi,
    I'm trying to get Eclipse TPTP to work. One of the steps I need to execute is to run a setConfig.bat file. When I ran it, I got the following error:
    ERROR: The Java Runtime in use does not contain a suitable JAXP feature
    RESOLUTION: Use a JRE which supports the JAXP featureI use Eclipse Europa, and it is using my JDK (actually JRE) 1.6.0_05. That should mean I have JAXP in my JRE (which is confirmed when I search on JAXP from the directory C:\Program Files\Java containing jdk1.6.5_05 and jre1.6.5_05 directories).
    Is there something extra I need to do to let Eclipse and TPTP find my JAXP classes?
    TIA,
    Abel

    Hi,
    Even i am getting the same error but i use JRE 1.5.0_14. please let me know if you happen to resolve this.
    Thanks in Advance,
    Sai

  • Java.io.StreamCorruptedException: InputStream does not contain a serialized object

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

  • I have tried downloading photoshop cs2 and cs4 on a new computer.  I have the disc available for cs2 and the serial number for cs4.  They are both registered in my name.  I need help doing a download.

    I have tried downloading photoshop cs2 and cs4 on a new computer.  I have the disc available for cs2 and the serial number for cs4.  They are both registered in my name.  I need help doing a download.  I was able to get part way through cs4, it showed up in my downloads but never got as far in the process as to ask for serial numbers.  I tried with cs2 and I got an error message that some bit of information was incorrect.  I currently have both downloaded on two other lap tops I own.  One is operational and one is dead.  I cannot access the dead one to remove the program. Thank you in advance for any assistance.

    For CS2 you will need to download a special new version
    CS2 Activation
    You might find CS4 download here
    Prodesign Tools — Photoshop Direct Download Links

  • How to call an applet from a first applet

    Hi,
    I need to call an applet from a first applet, but I want that the called applet doesn't execute in the same AppletContext than the first one, is it possible?
    If it is, what is the solution?
    Thanks

    Yes, it is possible. One way would be to use static variables.
    class A1 extends Applet
       public static A2 TheOther;
       public A1()
          A2.TheOther = this;
       public void callA2()
          TheOther.doSomething();
    class A2 extends Applet
       public static A1 TheOther;
       public A2()
          A1.TheOther = this;
       public void doSomething()

  • Need help coding simple applet program

    Hello I'm attempting to learn applet programming in either swing or awt. Whichever is best for current applications. I want to begin by creating my first hello world application. I want to create a simple applet that has two buttons, press button number one and the text "hello world 1" comes up somewhere on the applet, press two and "hello world 2" comes up. can anyone help me with this simple applet? Thnx in advance

    http://java.sun.com/docs/books/tutorial/applet/

Maybe you are looking for

  • Monitor All Windows Services on multiple Servers and Recover

    I am looking for a way to be able to create a monitor that will monitor All Servers for a Stopped Service set to Automatic.  I would also like for it to be able to Re-Start the Stopped Service Automatically. Surely SCOM can do this, as we are moving

  • Two Macs, one is on the wireless network, one isnt.

    To make a long story short, i have a mac pro, and a mac book pro. The router im using is a airport express. The mac book pro works no problem, and i just installed the wireless card in the mac pro, and it doenst see the router. The computer reconizes

  • Essbase corruption / Locked Object Problem

    Hi,(Using Essbase 6.5.1)Trying to delete an Essbase application / database. Says it cannot delete because an object is in a locked state. Object doesn't exist. Created an object with the same name (tried the object to be an outline, rules file, & cal

  • Failed in the execution of the ODCIINDEXINSERT routine while loading points

    I used SQL*Loader from 11.2 client to load million records into a 11.2 spatial table (points with longitude and latitude) and I got the following error: SQL*Loader: Release 11.2.0.1.0 - Production on Fri Oct 12 10:17:57 2012 Copyright (c) 1982, 2009,

  • Req number of function module

    Hi Experts, Can anybody plz send me the table where the request number of a function module get stored. (Function groups are stored in E071,But i need the request number for function module.) Regards, Anoop Chandran