Solved

One Applet calling another

Posted on 1998-10-02
3
817 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate insert example 13 37
jmss example java 2 31
Fast way to search item into Java Array (Rhino compatible) 2 37
How to log java errors in tomcat 8 24
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

735 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