Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

One Applet calling another

Posted on 1998-10-02
3
815 Views
Last Modified: 2008-03-04
1. I want to activate one applet, by pushing a bottun in another applet.
2. I want to activate a CGI by pressing a button in an applet.
How do I do it??
0
Comment
Question by:osnat
  • 2
3 Comments
 

Author Comment

by:osnat
ID: 1225275
Edited text of question
0
 
LVL 2

Accepted Solution

by:
shchuka earned 20 total points
ID: 1225276
What do you mean by "activate one applet by pushing a button in another applet"?  Do you want to load a page with the second applet when you push a button on the first applet?  In this case, you need to use this syntax:

this.getAppletContext().showDocument("url")

where url is the url of the page with the second applet.

As to CGI, there are two ways you can do it.  If it's a GET cgi, you can use the same syntax:

this.getAppletContext().showDocument("cgi-url?param1=val1&param2=val2...")

param=val strings should be url-encoded (e.g. " " changed into "+", and so on).  If you want to activate the POST cgi, you need to establish connection to the server through sockets and send the request in the form:

   POST /path/cgi-name HTTP/1.0
   Connection: Keep-Alive
   User-Agent: Mozilla/4.05 [en] (Win95; I)
   Host: www.cmscience.com
   Content-type: x-form-urlencoded
   Content-length: <length of your parameters string>
   Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
   Accept-Language: ru
   Accept-Charset: iso-8859-1,*,utf-8

   param1=val1&param2=val2...  (this is your parameter string).

Each line should end with "\r\n", not simply "\n".  The whole thing should be followed by "\r\n\r\n".  The problem with this method is that you're going to get back the html text output by the cgi program/script - you'll need to think of a way to display this html back into the browser.

Hope this helps,
-Aleks.
0
 

Author Comment

by:osnat
ID: 1225277
Thank u for your answer!
I still have a problem (I'm just a beginner in Java...)
I want to activate an applet, that it's location is the same as the applet that activaed it: on the same directory, on my computer. As the matter affect: It's like trying to execute a program. All I have is the applet name and it's class file. And I want that by a press of a button, this class file will be executed!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question