Solved

One Applet calling another

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
get weblogic logged in user in java 2 58
Java / Linux and Regular Expressions 11 71
Java - Why doesn't this JFrame work 3 45
nextBoolean(double p) for Random class 3 35
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now