On Sat, Aug 25, 2018 at 3:33 AM marwa hussein <marwa.huss...@gmail.com> wrote:
> Hello, Hi! > I am building a web application and I have to use an open source > Javascript package that is responsible for the visualization tasks. Now, I > need to pass a "string variable" from the javascript code to the java > code?? how to do this in tapestry5 ..Please refer me to a working example > if you can!! > Just use HTML's data attributes, just as Tapestry 5.4+ itself does. For example, supposing the div below is one which already exists in your page: <div id="visualization" data-visualization-data="${vizualizationData}"> Then, in your Java code, you compute the visualization data: public String getVisualizationData() { ... return data; } Then, in your JavaScript, supposing you're using jQuery: var visualizationData = $('#visualization').attr('visualization-data'); Notice the code above isn't tested. Of course, feel free to adapt it to your existing code. -- Thiago