This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes returning values from javascript function to java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "returning values from javascript function to java" Watch "returning values from javascript function to java" New topic
Author

returning values from javascript function to java

sarah cruz
Greenhorn

Joined: Sep 21, 2005
Posts: 10
hello, i have a function in javascript which returns a string. how do i access this string outside of my script, for example in java? thanks.

here is an example:

void main () {

String code = "x.onklick = function () { display () }"
browser.execute (code);
}

function display () {
return ("hello");
}

the question is how do i access the string returned by display after browser.execute? i.e., outside the script itself. thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Java and JavaScript work on two different levels. By the time the JavaScript is executed, the Java has been completed. You would have to submit a form or use Ajax to send the data back to the server.

Eric
[ May 31, 2006: Message edited by: Eric Pascarello ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: returning values from javascript function to java
 
Similar Threads
javascript inside java
on mousedown event
Javascript accessing jsp variable
display text string with Javascript on screen
Calling Javascript function from Java Code