Solved

One Applet calling another

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

776 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