Re: Calling java within javascript




misdst23 wrote:
I've come accross your point about javascript being on the client and
java on the server. BUT, the client side javascript function IS able to
pass a constant as a parameter to the server side java. It seems
logical to me that javascript should have a means to pass a variable.
Obviously, there is some sort of TCP connection going on in the back
end that allows the constant to be sent to the server. But since the
functionality is there maybe javascript should be standardized to allow
some way to pass a variable.

Your missing something very key here, that is javascript cannot access
java.
What is can access are the RESULTS of that java method. You see by the
time javascript is running, the JSP has already rendered itself to HTML
output and is done.



Thanks, I think i'll have to look into XMLHttpRequest.

Using this you can pass a javascript variable to serverside process. If
this results in changes on the page, you'll have to either reload the
page or execute the changes yourself in javascript.


Also, how can I use a image preload get to transmit a string to the
server, i've heard this is possible.

By using a server side process (like a servlet) to provide the image
data, and appending a query string to the img src parameter. The server
side process will receive the request (headers, parameters and all) and
can process it before transmitting image data back (or it may not
actually send anything back...)

HTH.


Thanks,

.



Relevant Pages

  • Re: Attempt to de-mystify AJAX
    ... I jumped into Java Server Faces because you could supposedly use it without JSP, using straight java code for everything. ... And since it is still an approach to client event handling on the server, it is suggested to incorporate javascript where needed. ... Java doesn't run in the browser and interact with the DOM. ...
    (comp.databases.pick)
  • Re: Java Applet pulled from VMS Web Server
    ... Java Applet JAR file are not "surfaced" by AJAX? ... 2a) Created a socket and connect back to the VMS server that is hosting the ... Are you really saying that Javascript is incapable of accessing any of the ...
    (comp.os.vms)
  • Re: Java Applet pulled from VMS Web Server
    ... connect back to the server that they were downloaded from. ... AJAX uses JavaScript not Java. ...
    (comp.os.vms)
  • Re: Interesting thread re: JS and IP.
    ... This is a Type III anonymous message, sent to you by the Winston Smith ... Project mixminion server at firenze.linux.it. ... JS can get IP, but cannot get the IP from behind a proxy (if Java ... >JavaScript hooks to Java almost seamlessly. ...
    (alt.privacy)
  • Re: Interesting thread re: JS and IP.
    ... Project mixminion server at firenze.linux.it. ... If you do not want to receive anonymous messages, please contact antani- admin@xxxxxxxxxxxxxxxxx For more information about anonymity, see ... As far as I'm aware they ALL makes calls to Java. ... Javascript has no facility to directly send info back ...
    (alt.privacy)