DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002

    can java send variables back to html code

    I am looking to write a small java applet to check to see if a server is up and running and if not stay where it is... The server in which it will reside does not have CGI support, but I am running a webserver on my school/home IP and I want the school website to access my schoo/home server if I have it up and running and if not use a default page...

  2. #2
    Join Date
    Jul 2002


    Just thinking aloud, java progs can create a socket connection to a server... why can't an applet? (Though I know applets have very strict security guidelines for i/o writing to files).

    What I'm envisioning is a simple applet where you input a URL address, click a button, and the applet will attempt to open a connection on port 80 (standard http port) and grab the html file headers.

    Actually, I guess you don't want this to be interactive on the html side: just a matter of: "Either stay on the school site, or redirect to the home web site"

    If successful, hmm, here's the tricky part: I guess if it is successful, you want the user/viewer redirected to the new server.... yep, yep, I think the URL class has a method to do that...

    So, the pseudo-code would be something like this:

    User goes to School Web server page; that page runs an applet (onLoad( ) javascript function or something like that)

    Applet tests to see if homeserver is active:
    String homeurl = input from html applet param tag on school html page;
    if(connection-to-homeurl port-80)
    redirect to home web server;
    stay on school server

    I need to get ready for the day, but I'll take a try at this later and see if it just might be doable

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

By using this site, you agree to the Privacy Policy