Solved

application not applet; open new window separate from browser

Posted on 1998-01-09
6
328 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
[X]
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
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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…

615 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