Recieve GET POST data, java?

Parsa44

New Member
Messages
232
Reaction score
0
Points
0
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:
<?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: )
 

ah-blabla

New Member
Messages
375
Reaction score
7
Points
0
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:

Parsa44

New Member
Messages
232
Reaction score
0
Points
0
Thanks for your reply :biggrin:
I suspected that might be the case =(
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
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.
 
Top