Hi,

    In applet-servlet communication, i am passing the parameter from the
applet URL.
Inthe URL I included the parameters,but I am  not able to get the value from
the servlet, it establishes connection with the servlet, and processing the
function correctly.



import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
import java.io.*;
import java.util.*;


public class appser extends Applet
{


        public void init()
        {

                        try {

     URL newURL = new
URL("http://127.0.0.1:8080/servlet/helloservlet?name=sss&dept=cs&place=cary");
            System.out.println("newURL: " + newURL);
            AppletContext context = getAppletContext();
            context.showDocument(newURL, "bottom");
           URLConnection conn =  newURL.openConnection();

           conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setUseCaches(false);

            conn.setRequestProperty("Content-Type",
                                    "application/x-www-form-urlencoded");

  DataOutputStream out = new DataOutputStream(conn.getOutputStream());

           DataInputStream in = new DataInputStream(conn.getInputStream());
           String str;
           System.out.println(conn);
           while((str=in.readLine())!=null)
           System.out.println( str);
                        } catch (Exception e) {
            e.printStackTrace();
        }

        }


         public String toEncodedString(Properties args) {
        StringBuffer sb = new StringBuffer();
        if (args != null) {
            String sep = "";
            Enumeration names = args.propertyNames();
            while (names.hasMoreElements()) {
                String name = (String)names.nextElement();
                sb.append(sep + URLEncoder.encode(name) + "=" +
                          URLEncoder.encode(args.getProperty(name)));
                sep = "&";
            }
        }
        return sb.toString();
    }

    public void destroy()
    {
        System.out.println("in destroy");
}
}

Any help will be appreciated
bye
kavitha


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
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