POST / GET from applet ?action=load (servlet side)

    try {
        out= new ObjectOutputStream(response.getOutputStream());
        logger.debug("Sending object to applet.");
        out.writeObject((Object)object);
        out.flush();
        return;
    }
    catch (IOException e){
        logger.debug("Exception " + e.getMessage());
    }

POST / GET from applet, ?action=save (servlet side)

    try  {
        ObjectInputStream in = new
ObjectInputStream(request.getInputStream());
        logger.debug("Receiving object from applet.");
        object = (Object)in.readObject();
    }
    catch (IOException e){
        logger.debug("Exception " + e.getMessage());
    }


-----Original Message-----
From: Dola Woolfe [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 21, 2006 3:27 PM
To: Tomcat Users List
Subject: Re: Sending a lot of info the a jsp page




--- Bill Barker <[EMAIL PROTECTED]> wrote:

> 
> "Dola Woolfe" <[EMAIL PROTECTED]> wrote in message
>
news:[EMAIL PROTECTED]
> > Hi,
> >
> > This question will reveal how little I know about networking or http 
> > or something else.
> >
> > Basically I wrote an applet that sends data to a
> > servlet. I do it by forming a url with a query
> string
> > (GET). But this doesn't work when there's too much
> > data.
> >
> > What are my options?
> > Is it possible to use POST?
> > Or, better yet, is it possible to send a java
> object
> > by creating a socket connection with the servlet?
> >
> 
> Actually, combining these two is often easiest (of
> course, your java Object
> must implement Serializable for this to work). 
> Something like (Applet 
> code):
> 
>      URL servlet = new URL(getDocumentBase(), "/path/to/my/servlet");
>      HttpURLConnection conn =
> (HttpURLConnection)servlet.openConnection();
>      conn.setDoInput(true);
>      conn.setDoOutput(true);
>      conn.setRequestMethod("POST");
>      conn.setHeaderField("Content-Type",
> "application/x-java");
>      ObjectOutputStream out = new 
> ObjectOutputStream(conn.getOutputStream());
>      out.writeObject(myObject);
>      int status = conn.getResponseCode();
>      if(isOK(status)) {
>          InputStream in = conn.getInputStream();
>         // Handle response here.
>      }
> 
That's fantastic! And what does the jsp side look
like? I only know how to get data through
getParameter...


Thanks!
> 
> > Very many thanks in advance!
> >
> > Dola
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to