Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » swt browser class, how to get the value of the html controls
swt browser class, how to get the value of the html controls [message #853702] Mon, 23 April 2012 08:59 Go to next message
ocean xue is currently offline ocean xue
Messages: 107
Registered: November 2011
Senior Member
swt browser class, how to get the value of the html controls
Re: swt browser class, how to get the value of the html controls [message #853748 is a reply to message #853702] Mon, 23 April 2012 09:47 Go to previous messageGo to next message
Simon Scholz is currently offline Simon Scholz
Messages: 73
Registered: April 2012
Location: Germany
Member
You can use the following function to run JavaScript Code and then return the desired value in the JavaScript code.

help.eclipse.org/galileo/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html#evaluate(java.lang.String)

Object value = browser.evaluate("return document.getElementById('YOUR_CONTROLS_ID').value");


You are able to access everything via JavaScript and DOM.

You can also execute JavaScript methods/functions like

Object value = browser.evaluate("getACertainValue()");


As you can see in the JavaDoc of the evaluate method, the following types of objects can be mapped from JavaScript to an Java object:

javascript null or undefined -> null
javascript number -> java.lang.Double
javascript string -> java.lang.String
javascript boolean -> java.lang.Boolean
javascript array whose elements are all of supported types -> java.lang.Object[]

Best regards,

Simon

[Updated on: Mon, 23 April 2012 12:08]

Report message to a moderator

Re: swt browser class, how to get the value of the html controls [message #854443 is a reply to message #853748] Tue, 24 April 2012 00:45 Go to previous message
ocean xue is currently offline ocean xue
Messages: 107
Registered: November 2011
Senior Member
thank you

[Updated on: Tue, 24 April 2012 01:13]

Report message to a moderator

Previous Topic:How can I select an item in a tree programmatically?
Next Topic:Importing WTP xml editor functionality in to an RCP
Goto Forum:
  


Current Time: Tue Oct 21 21:35:11 GMT 2014

Powered by FUDForum. Page generated in 0.02112 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software