Kavitha,
I tried your code and found that it's working perfectly. I don't know where
you're getting error. Only change I have made is the url. I gave 100.0.0.3
my machine's IP address insteade of giving local host's IP (127.0.0.1)
address. It works fine.
Regards,
Kumaravadivelu
-----Original Message-----
From: kavitha ramasamy <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, December 07, 1999 9:19 AM
Subject: getparameter in applet-servlet communication
>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
___________________________________________________________________________
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