Re: How to pass a variable from Javascript code to Java

2018-08-30 Thread Cezary Biernacki
While cookies can be used the way you describe, I would like to warn that they have several drawbacks. They are added to every requests from the browser to the server, until they expire or some code explicitly deletes them. It means that the size of unrelated requests might grow. Also it complicate

Re: How to pass a variable from Javascript code to Java

2018-08-29 Thread heph estos
And how about storing the value to a session or a cookie from javascript and reading from java server through an implemantation of observer parttern? It would work in any case, in any framework. Στις Τετ, 29 Αυγ 2018, 2:39 μ.μ. ο χρήστης marwa hussein < marwa.huss...@gmail.com> έγραψε: > Hi, > Th

Re: How to pass a variable from Javascript code to Java

2018-08-29 Thread marwa hussein
Hi, Thank you all for guiding me to the solution especially "Numa" .. and this is how I solved it: for the .tml and in the JS JQuery file, I passed the variable in a JSON object --> data: {myData:dataToSend} $('#myId').click(function() { var dataToSend= $('#myId').data('mydata'); ajax('answer',

Re: How to pass a variable from Javascript code to Java

2018-08-28 Thread Numa Schmeder
Hello Marwa, The answer provided by Thiago is much simpler. Just put your data in a data attribute of a tag and then use the tutorial ajax and zones to send this data to a server side event handler. If you want to do it automatically without triggering a javascript event, just put you script i

Re: How to pass a variable from Javascript code to Java

2018-08-28 Thread marwa hussein
Hello, Thanks all for your suggestions. I followed the example shown in https://tapestry.apache.org/ajax-and-zones.html in "Invoking server-side event handler methods from JavaScript" but here the event is in the java code "server-side" and is invoked from the Javascript code "onClick()" , but w

Re: How to pass a variable from Javascript code to Java

2018-08-27 Thread Thiago H. de Paula Figueiredo
I've just noticed Peter had already posted the same answer as me. I'm sorry. On Mon, Aug 27, 2018 at 3:24 PM Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Sat, Aug 25, 2018 at 3:33 AM marwa hussein > wrote: > >> Hello, > > > Hi! > > >> I am building a web application and I have

Re: How to pass a variable from Javascript code to Java

2018-08-27 Thread Thiago H. de Paula Figueiredo
Hello! See the Invoking server-side event handler methods from JavaScript in https://tapestry.apache.org/ajax-and-zones.html. It has an example of how to do it in Tapestry 5.4.2+. There's no easy way of doing it than this. On Mon, Aug 27, 2018 at 4:47 AM wrote: > Hi Marwa, > > there is an examp

Re: How to pass a variable from Javascript code to Java

2018-08-27 Thread Thiago H. de Paula Figueiredo
On Sat, Aug 25, 2018 at 3:33 AM marwa hussein 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?? ho

Re: How to pass a variable from Javascript code to Java

2018-08-27 Thread peter . skala
Hi Marwa, there is an example in the bottom part of this page https://tapestry.apache.org/ajax-and-zones.html which you can use for your development. The paragraph "Invoking server-side event handler methods from JavaScript" contains the corresponding explanation. If you do not want to use zon

Re: How to pass a variable from Javascript code to Java

2018-08-26 Thread marwa hussein
Thanks for your replay but actually I scanned all the links and I couldn't find an answer for my issue... Let me explain it in more details ..in the .tml code I have this line Name: and in the javascript code, there is a function that calculates the "name" for this element and another that creates