RAP JavaScriptExecutor and returning values [message #1117566] |
Thu, 26 September 2013 15:23 |
|
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 |
Ivan Furnadjiev Messages: 2427 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 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.16374 seconds