Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP JavaScriptExecutor and returning values(Can JavaScriptExecutor return values from JS functions)
RAP JavaScriptExecutor and returning values [message #1117566] Thu, 26 September 2013 15:23 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 198
Registered: November 2012
Location: UK
Senior Member
I use JavaScriptExecutor with RAP, which is nice for simple JS execution e.g.

JavaScriptExecutor executor = RWT.getClient().getService( JavaScriptExecutor.class );
if( executor != null ) {
  executor.execute( javaScriptCode );
}


However, is there a way to do something similar to execute a javascript function that returns a value, and capture that value... a bit like evaluate for browser controls, but acts on the whole page?

My initial requirement might be a javascript function that gets the value of a cookie on the client.

Thanks, John


---
Just because you can doesn't mean you should
Re: RAP JavaScriptExecutor and returning values [message #1117648 is a reply to message #1117566] Thu, 26 September 2013 17:06 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1872
Registered: July 2009
Senior Member
Hi John,
JavaScriptExecutor#execute does not return a value. Why are you not
using RWT.getRequest().getCookies()?
Best,
Ivan

On 9/26/2013 6:23 PM, John Gymer wrote:
> I use JavaScriptExecutor with RAP, which is nice for simple JS
> execution e.g.
>
>
> JavaScriptExecutor executor = RWT.getClient().getService(
> JavaScriptExecutor.class );
> if( executor != null ) {
> executor.execute( javaScriptCode );
> }
>
>
> However, is there a way to do something similar to execute a
> javascript function that returns a value, and capture that value... a
> bit like evaluate for browser controls, but acts on the whole page?
>
> My initial requirement might be a javascript function that gets the
> value of a cookie on the client.
>
> Thanks, John
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP JavaScriptExecutor and returning values [message #1118354 is a reply to message #1117648] Fri, 27 September 2013 10:18 Go to previous message
John Gymer is currently offline John GymerFriend
Messages: 198
Registered: November 2012
Location: UK
Senior Member
Hi Ivan,
Ok, yes, for cookies I can use RWT.getRequest().getCookies(), and this works ok, including RWT.getResponse.addCookie(...).
However, it was more of a general question about JavaScript... if I loaded some JavaScript using JavaScriptLoader, then wanted to call a function later to evaluate to a value, then there is no way to do this.
I'm not sure it matters too much, but thought it could potentially have some uses.
Thanks, John


---
Just because you can doesn't mean you should
Previous Topic:add bookmark/favorit using javascript
Next Topic:SettingStore not working between AppSvr cycles
Goto Forum:
  


Current Time: Thu Dec 18 08:46:45 GMT 2014

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

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