DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    1

    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
    Posts
    60

    Lightbulb

    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;
    else
    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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links