Solved

application not applet; open new window separate from browser

Posted on 1998-01-09
6
300 Views
Last Modified: 2012-06-21
Hi,
  I'm writing a web client server app, some of which is in java.  A perl cgi script is called from the browser which forks a child process, and the child looks like this...

  else {
    $resnum--;
    $cmd = "java progressClient $resnum";
    exec $cmd;
    exit(0);
  }

The first part of the java application looks like this...

import java.awt.*;
import java.io.* ;
import java.net.* ;
class progressClient extends java.applet.Applet {
  public static void main(String[] args) {
    Frame frame = new Frame("Your inquiry is being processed");
    frame.setSize(300,200);
    frame.setVisible(true);
  // more code, mostly passing data back and forth thru a   //socket.

... but this code gets hung up and the new window never appears.  
I'd like to be able to open this new window to show the progress of a transaction which could take as long as 5 minutes, leaving the main browser window free for other activity while the customer waits.  The "extends
java.applet.Applet" was just a shot in the dark.  I really don't want to have to use an applet at all because so many people are still using browsers that won't run applets.  I would appreciate any suggestions.  I could open the new
window earlier, in the perl script, but after that, I wouldn't know how to manipulate the strings the program creates so that they'd show up in that
window.  Thank you!
0
Comment
Question by:zingbust
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:jpk041897
ID: 1232101
Are you writing this on UNIX or PC plattforms?

Either way, I am assuming that you are calling the Perl script as a CGI. In either case, I'm not sure what you are trying to acomplish.

Do you want the frame to appear on the client or on the server?

If it on the the server, you will need to run the Java code in a new shell, if on the client, your code is completley shot and will not be able to display the frame on the client at all. For that, you would need to write an Applet that can launch the Script, synchronize with the script untill all data is available, transfer the data and then display itself.
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 1232102
If I understand what you've said above, you are trying to have a PERL cgi program on your server invoke a JAVA application (or applet) on client's browser to show that the operation is taking a long time.  If this is the case, your approach as show above is wrong.  First, a cgi-bin server program can't invoke Java on the client under any circumstances.  It could format a page to the output stream back to the browser which included an <APPLET> tag that the browser could (if it wanted to) load and run.  The only way it could process updates to the progress, however, would be to establish a network connection to another process on the server and receive status messages about the processing.  Even in that case, the applet would get clobbered if the user opened a new page or closed the browser.
0
 

Author Comment

by:zingbust
ID: 1232103
Thanks guys, and let me clarify a bit what I'm trying to do.
It's an information system that allows web users to submit from a web form a request for a transaction.  The transaction takes place by telephone.  A telephony server on my pc at home makes a phone call and delivers the transaction request to the business.  The business responds via touch-tone phone or voice message.  The telephony server relays the response back to the web user.  The web server is a unix platform.  The perl cgi script is what takes over after the user presses submit.  The forked process calls the java application I referred to in my question.  This application is run on the same unix machine as the perl script, it is NOT an applet run on the client's machine.  The java application makes a socket connection to the telephony application.  I would like a popup window to appear shortly after the user presses the submit button.  The java application is capable of keeping track of each phase of the transaction by receiving strings of text that come from the socket connection.  I would like to somehow be able to send these strings of text to the popup window..."Making connection to telephony server..."  "Dialing phone number of business..." "Party has answered the phone..."  "Transaction being processed, please wait..." "Transaction confirmed". The perl script's function is to return the html that the user would see in the main browser window.  Hopefully I could make it so that the main browser window is free and finished of it's duties so that the user could continue browsing while still having the popup window to look at to observe the progress of the transaction.  I realize the approach I was trying is no good, but surely there must be a way to accomplish this!?  Thanks for your input!!
0
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.

 
LVL 6

Expert Comment

by:jpk041897
ID: 1232104
Any particular reason why you cant have teh Java app. running all the time and polling either a file or a socket to obtain the strings?
0
 

Author Comment

by:zingbust
ID: 1232105
To JPK: That is what I'm doing with the java application.  Problem is that I don't know how to send the strings to a new window, don't know exactly how or when I should try to open the new window for dynamic output.  Only examples I've seen open a with window.open(something.htm, etc, etc).  How do I get these strings into something.htm?  Can I do it without using an applet?
Should I find an ActiveX control that would do the job?
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1232106
The new window could be a frame or a modeless dialog. If its a modeless dialog, its code is still active even when minimized or hidden by the parent frame.

There are several mechanisms you could then use to determine te contents of the transfered strings. For instance, you could use a flag in a static class, the existance of a file either on disk or on a remote server, etc.

The main trick is to have a permanently open window that hides itself when not needed. If you need more than one window, you could create a dialog (or frame) instance for each client.
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
Free Alternative to JIRA 4 91
Requested array size exceeds VM limit 3 84
eclipse java  build path 6 44
Cipher Configuration on Apache HTTPD 4 53
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 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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

920 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

16 Experts available now in Live!

Get 1:1 Help Now