Skip to main content


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: 279
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: 2426
Registered: July 2009
Location: Sofia, Bulgaria
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: 279
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:Session Failover, JBoss 7 AS / EAP 6 and RAP 2.1
Next Topic:[ANN] RAP 2.1 SR1 is available
Goto Forum:
  


Current Time: Thu Apr 25 07:51:53 GMT 2024

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

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

Back to the top