📜 ⬆️ ⬇️

Get data from Javascript via Java functions

The hobbit or back and forth


Some time ago, I urgently needed to find possible ways to get variables from js and the browser in order to transfer their value in my application to java. Unfortunately, this question was not solved on Habré, or perhaps the power left me and the search is no longer so easy.
Anyway, today I will try to shed some light on this issue to some extent. So let's get started!

Task

In short, I will describe the situation - there is a certain application with the editor page, as editor we have a free NiceEdit . Why exactly the external editor - I needed to quickly build in the editor + the user data is presented as html and writing a bike would be quite silly. There were attempts to build a ready-made widget on swt, but either the project is outdated or the author has turned his head - the widget refused to work.
The main problem is that the user enters / edits the data in the editor, clicks the miracle button, and our application should receive what has just been written.

Decision

As it turned out, there is more than one solution to this problem:

Here are both ways that I know and used ... I will be glad to read new ideas and comments on the article. Thanks for attention.

')

Source: https://habr.com/ru/post/123314/


All Articles