+ Reply to Thread
Results 1 to 4 of 4

Thread: Recieve GET POST data, java?

  1. #1
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Recieve GET POST data, java?

    I am going to embed a java application on a webpage and I am wondering if it is possible to do any of the following things

    Is it possible to recieve GET or POST data using java.
    For example to recieve GET data in php we would write:

    PHP Code:
    <?php
    $data 
    $_GET['name'];
    ?>
    Can something similar to this be done in java?

    If this is not possible would I be able to read the full URL of the page where the java object is embedded?

    The reason I want to know if this is possible is so I can send data from another page on my website that doesnt have java to a java application on a different page.

    ( I know I am a complete java noob. :nuts: )

  2. #2
    ah-blabla's Avatar
    ah-blabla is offline x10 Lieutenant ah-blabla is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    375

    Re: Recieve GET POST data, java?

    You can't retrieve it, since the java application isn't running as a server / on the server, and GET and POST are parts of a http request. (It seems you are assuming that the java application is running on the server: if it is embedded, i.e. as an applet, then it runs on the client's computer and not the server. If it is embedded, the server doesn't know anything about the application, apart from that it is a file, which it sends to the visitor as part of the webpage.) What you might want to do is have the java application get data from the server, which is possible, using something like HttpURLConnection.
    Last edited by ah-blabla; 11-29-2009 at 07:43 AM.

  3. #3
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Re: Recieve GET POST data, java?

    Thanks for your reply
    I suspected that might be the case =(

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Recieve GET POST data, java?

    Since you'll be running the Java applet client-side, you can use a Java-Javascript bridge to access the document, including form values, within your Java applet. To access JS in Java, use JSObject. You can also access Java from Javascript. Sun's documentation on Java-Javascript communication has a detailed breakdown of the technologies. See also "JS to Java communication" and "Java to JS communication" on MDC.

    Though different browsers use different technologies for the JS-to-Java bridge (e.g. LiveConnect, ActiveX), the interfaces are similar enough.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Suggestions for best way to build a MySQL table from raw data?
    By ParallelLogic in forum Programming Help
    Replies: 5
    Last Post: 07-05-2009, 02:39 AM
  2. VPS - JAVA JDK Help
    By allofus in forum Programming Help
    Replies: 12
    Last Post: 03-14-2009, 12:09 PM
  3. Anfy Java Applet Online problems
    By Tharu in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 08-02-2008, 09:05 PM
  4. Gamer's Lounge Rules - Read before you post!
    By tnl2k7 in forum Gamer's Lounge
    Replies: 0
    Last Post: 05-07-2008, 12:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers