Hello,
I don't think you really need an instance of a servlet ...
If you want to call the servlet from an applet just use something like this :


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

public class TestApplet extends Applet implements ActionListener {

   TextField tfQuery,pwQuery;
   TextArea taResults;
   Button btnExecute;

   public void init() {
       ....
   }

   public void executeQuery() {

      String userString = tfQuery.getText();
      String pwString = pwQuery.getText();

      try {
         String user =  URLEncoder.encode("user") + "=" +
                        URLEncoder.encode(userString)+ "&" +
            URLEncoder.encode("password") + "=" +
                        URLEncoder.encode(pwString);
         URL monUrl = new URL("http://www.jnt.ces/Sylvie/servlet/ServletElt"; +
"?" + user);

         getAppletContext().showDocument(monUrl);
      } catch(MalformedURLException e) {
         taResults.setText(taResults.getText() + "\n" + e.toString());
      } catch(IOException e) {
         taResults.setText(taResults.getText() + "\n" + e.toString());
      }
   }

Is that what you wanted to do ?

Sylvie.

MONICA GARCIA QUESADA a �crit :

> Hello,
>
> Does anybody know how can I  instance a servlet class in an applet?
>
> Thanks,
>
> M�nica Garc�a Quesada
> Mercados y Tecnolog�as
> Grupo Desarrollo Internet
> SOLUZIONA TELECOMUNICACIONES
> SERVICIOS PROFESIONALES DE UNI�N FENOSA
> Infanta Mercedes, 31 -2� Pl.
> 28020 MADRID
> TEL.: 915793000
> FAX 915790708
> E-MAIL: [EMAIL PROTECTED]
> www.soluziona.com
> www.ipt.es
>
> ___________________________________________________________________________
> 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

Reply via email to