Click to See Complete Forum and Search --> : How to use javascript variable in java-code in a jsp


rbollen
05-23-2003, 05:01 AM
Hiyaa

Does anyone know how to use a javascript variable in java code of a jsp page??

Thanx in advance

Gollum
05-23-2003, 05:46 AM
There is a thing called the JSObject Class:

import netscape.javascript.JSObject
...

JSObject jsroot = JSObject.getWindow(this); // gets the containing window

// get a property of the window object
String value = jsroot.getMember("status");

// open a popup window
Object[] args = { "http://somewhere.com", "mypopup"};
JSObject win = jsroot.call("open", args);



but beware, it's liable to have bugs and have Netscape-IE compatability problems

khalidali63
05-23-2003, 11:22 AM
On the other hand a java applet can pass a javascript variable/object to the java classes if that will work for you..

:D