Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • Last Modified:

application not applet; open new window separate from browser

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
zingbust
Asked:
zingbust
  • 3
  • 2
1 Solution
 
jpk041897Commented:
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
 
jhanceCommented:
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
 
zingbustAuthor Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jpk041897Commented:
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
 
zingbustAuthor Commented:
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
 
jpk041897Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now