www.teamdev.com

This Question is Answered

2 "helpful" answers available (2 pts)
2 Replies Last post: Aug 7, 2008 5:13 PM by Azbok  
Click to view Azbok's profile   3 posts since
Jul 15, 2008

Aug 6, 2008 3:35 AM

Best method of bidirectional communication java <-> web page?

I'd like to do 2 things
1) My java app has some data that I'd like to inject into my own custom webpage. Would the best way to do this be using evaluateScript() and call a javascript function in that custom webpage with JSON data? Then the webpage can update itself as necessary based on that new data.

2) My webpage has some data that I'd like the java app to have. This seems a bit trickier, but perhaps you can use the TitleChangeEvent? So for example the javascript on the webpage can set a javascript variable and then update the title. The java's TitleChangeEvent would fire, then execute evaluateScript() in order to retrieve the variable's data. Or maybe even I could put the data right into the title!

Would the above actually work? Is there a better way to accomplish that goal?

Thanks!
Click to view Victor Gubin's profile TeamDev Ltd. 83 posts since
Dec 17, 2007
1. Aug 7, 2008 3:47 PM in response to: Azbok
Re: Best method of bidirectional communication java <-> web page?
I think that AJAX approach (ie page updates itself as needed) a lot better than the use evaluateScript or setContent functions.
This will be much more correct than modification of browser for a specific web page.

Though you can use any of the methods.