shaolindoman has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks. I've been working on putting an applet in one of my scripts that accesses a database and prints the results as a horizontal scrolling "news flash" type deal accorss the top. Well, as an html page everything works fine. howver, when I put the html code for the applet into a cgi script, the page just loads with an empty box and it says the newsticker.class file in the status bar can't be found(using IE 5.x and I've tried it with Firefox and it does about the same thing). Well when I view the source and save it as an html file in the same directory as the cgi script and open this new html file, the news ticker works fine. Can you not run applet code inside of cgi scripts or am I making another mistake. All the paths are correct, so I know that's not the problem. Any suggestions. Thanks. (Also if anyone knows of a good site with free news tickers that can update from files/db let me know)

Replies are listed 'Best First'.
Re: applets in CGI
by chromatic (Archbishop) on Aug 25, 2004 at 18:21 UTC

    Decent web browsers don't care how the server generated HTML. They'll handle it the same whether it's static, from a CGI program written in C, Perl, Tcl, or some shell, or from an application server.

    I suspect the paths or permissions are incorrect somehow. Without seeing your code and configuration information, however, all anyone can do is guess.

      Here is the code. Very simple really:
      use strict; use CGI qw(:standard); print<<TO_END; Content-type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> </HEAD> <BODY> <applet code="menuscroll2.class" width="460" height="18"> <param name="applet_width" value="460"> <param name="applet_height" value="18"> <param name="regcode" value=""> <param name="info" value="Applet by Gokhan Dagli,www.appletcollection. +com"> <param name="bgcolor" value="#00000"> <param name="border_color" value="red"> <param name="text_color" value="green"> <param name="highlight_text_color" value="000000"> <param name="rect_color" value="E8B200"> <param name="highlight_rect_color" value="red"> <param name="arrow_color" value="000000"> <param name="highlight_arrow_color" value="blue"> <param name="arrow_bgcolor" value="E8B200"> <param name="font_type" value="Arial"> <param name="font_size" value="15"> <param name="font_style" value="0"> <param name="border" value="no"> <param name="space" value="10"> <param name="scroll_delay" value="50"> <param name="xspace" value="1"> <param name="scroll_jump" value="1"> <param name="yposition" value="14"> <param name="mouse_over" value="normal"> <param name="text1" value="Sire 1! Goes Here"> <param name="link1" value="http://www.appletcollection.com/popular.htm +l"> <param name="text2" value="Sire Two 2323 HEre"> <param name="link2" value="http://www.appletcollection.com/advnewsscro +ll.html"> </applet> </BODY> </HTML> TO_END
        Do you need to give menuscroll2.class a path? Since your running a cgi-bin program, it is probably looking for menuscroll2.class in the cgi-bin directory.