简体   繁体   中英

Converting Java Object -> JavaScript -> Reading from Applet

I'm a bit stuck with this concept that I've been working on and I'm looking for some sort of guide on this. Essentially this is the problem:

Bean retrieves data from database and I need to store it as a hidden field on a webpage. The user then must authenticate the data using an applet. The resulting authenticated object is then sent to the database.

So i'm stuck at this paradigm:

Bean -> Html & Javascript -> Applet

I think I can figure out the upload issue later, thanks :)

Edit: Switch Authenticate with Sign :)

Edit2: It seems I have some data using JSObject but how do I retrieve the data from the JSObject? The data was stored as a DataHandler before it was read by javascript and acquired by the applet. I'm looking into the getClass() method call from the JSObject but it gives me an HTMLInputElement and I'm not sure where to go from there.

Not sure why you chose to use Applets, but from recent JDKs onwards (I think its JDK 1.6 not sure) an Applet has access to the Javascript variables and HTML DOM. So yes you can do it... you might want to ask yourself why you want to go down this route though.

Some more info:

The JSObject class helps you access Javascript from a Java applet. http://java.sun.com/products/plugin/1.3/docs/jsobject.html

Update: Actually its much older than JDK 1.6 http://download.oracle.com/javase/1.4.2/docs/guide/plugin/developer_guide/java_js.html

If you need to access the HTML structure of the page you can also access the DOM in the same way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM