tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From =?ks_c_5601-1987?B?w9a/tbHU?= <>
Subject About Servlet-Applet Communication
Date Mon, 09 Oct 2000 15:58:34 GMT
I have difficulty in Servlet-Applet Communication.
I go around SUN Developer Connection and try as some pieces of
advice I saw there.
I could transfer parameter from Applet to Servlet.
Like it.
   Using URL, URLConnection Object
   URL  url = new URL("http://hums/services/servlet/SomeServlet");
   URLConnection uc = url.openConnection();
   String  qry  =  URLEncoder.encode(  "qry"  )  +  "="  +  URLEncoder.encode(  qryString
   uc.setRequestProperty("Content-type",application/x-www-form-urlencoded"  ); 
    DataOutputStream  dos  =  new  DataOutputStream(  uc.getOutputStream()  ); 
   dos.writeBytes(  qry  ); 

    And in  SomeServlet , HttpServletRequest req can catch parameter
   with req.getParameter("qry"); using doPost Method or service  method.
   But I don't know how servlet give response applet back..
   I tried HttpServletResponse.getOutputStream() or PrintWriter Object
  or DataOuputStream(HttpServletResponse.getOutputStream());
  But all failed in anyway..

   ps. I want to know communication with Object transfer in addition to Primitive Type with
  Of course,I guess ObjectOut(In)putStream will be used with implementing Serializable Interface.
  I want see any example..
     Regard Choi..
View raw message