Ed Watkeys wrote:
> 
> On Wed, 9 Jun 1999, Raimee Stevens wrote:
> 
> > This is a RE-POST since I haven't had any response.
> 
> 1. The fact that no one replied to your message the first time should
> indicate to you that maybe you should try to rephrase your question.
> 
> 2. I read your message the first time but couldn't figure out what you
> were doing. Specifically, how are you passing the vector from a
> servlet to an applet? It sounds vaguely like you're printing the
> vector to an output stream, and you're getting the string
> representation. Unless you're using RMI, object serialization, or
> something similar, you can't just "pass" a vector from a servlet to an
> applet.

OK,

First, thanks Mathew for your suggestion.  I don't know if your code
compiles but it looked good.  And you're right, my question isn't JServ
related per se, it was a Java coding question.  However, I had no
nowhere else to turn (hmmm.)

Ed, exactly.  I am "printing the
vector to an output stream, and getting the string representation."

Ill try to be more precise with my question next time.  But since Java
is new to me, I wasn't sure what to ask.  I was so close...I'll be
brief:

/* *****************************************
 * r e a d s e r v l e t D a t a V e c t o r ( )
 * This method receives a serialized vector of String Objects
 * from a Servlet.  I was initializing the servletDataVector with 1
Element. 
 * That's why I had only one line in my applet lstBox.
 */
        public Vector readservletDataVector(ObjectInputStream
theInputFromServlet)
        {
                Vector theservletDataVector = new Vector();
        
                try
                {       
                        // read the serialized vector String Objects 
                        //  **This was the problem:
                
//theservletDataVector.addElement(theInputFromServlet.readObject().toStirng());

                        //This is how I fixed it:
                        theservletDataVector = (Vector) 
theInputFromServlet.readObject();

                        //Close the connection
                        theInputFromServlet.close();
                }
                
                catch (IOException e)
                {
                        log(e.toString());    
                }       
        
                catch (Exception e)
                {
                        System.out.println(e);                          
                }
                return theservletDataVector;
        }

Thanks again.


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Problems?:       [EMAIL PROTECTED]

Reply via email to