Sightly: Using Both Javascript and Java


Designed to separate logic from view, Sightly allows the logic to be placed into Java files that extend the WCMUse interface. Feike Visser provided examples of how that works in his post, Sightly Intro Part 4. The Java classes are integrated with the Sightly code using the data-sly-use attribute. Sightly also allows using Javascript to implement the logic as well using the same attribute, data-sly-use. Now, in theory, it is possible to get data from the Javascript connected to Sightly through a data-sly-use attribute and pass it to the Java connected through a different data-sly-use, isn’t it? That was the question asked on the Adobe forums.

An answer to the question came back from Feike and that answer provides insight in the way Javascript data is integrated into Sightly and how that data can be used in Java.

Original question: how to use data from Javascript in Sightly?

Follow-up question: and how can data from Javascript be passed by Sightly to Java?

About The Author

Deke departed Southern Alabama as a young man, leaving the humidity and fire ants behind. The fire ants are catching up with him. He works for Adobe. Despite that, his opinions expressed on this site are his own and should never, ever, be attributed or blamed on Adobe. Ask him what he thinks of chiggars sometime. Home Page | GitHub | Adobe Blog | Twitter | LinkedIn