import java.io.*;
import java.net.*;

public class five
{
 static char[] c = {'s','u','c','c','e','s','s'};
 public static void main(String[] args)
 {
  String mainURL = "http://164.164.61.118:8080/servlet/test";
  try
  {
   String sri = "success";
   int x = 0;
   URL url = new URL(mainURL);
                  System.out.println("The url is " + url);
   URLConnection urlc = url.openConnection();
   urlc.setDoOutput(true);
   OutputStreamWriter osw = new
OutputStreamWriter(urlc.getOutputStream());
   osw.write(sri,0,sri.length());
   osw.close();
   System.out.println("I am near input");
   InputStreamReader isr = new InputStreamReader(urlc.getInputStream());

   x = isr.read(c,0,6);
    if ( (x != -1) )
    {
     String fin = new String(c);
     System.out.println("The final str is " + fin);
    }
    else
    {
     System.out.println("Couldnt read from the test");
    }
   isr.close();
    }
  catch(MalformedURLException mfe)
  {
   System.out.println("The message is " + mfe.getMessage());
  }
  catch(IOException ioe)
  {
   System.out.println("The io error is " + ioe.getMessage());
  }
 }
}


Just look into this code i am trying to write something to a servlet and
tryin to retrieve it, but what i need is that once i write to a servlet
i need to store them in a variable for future manipulation how shall i
do that?? i got struck with this for quite few hrs pls help me ....

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to