Pages

Saturday, January 16, 2010

Javascript in Tapestry5

Okay, lets start from the beginning.

This is the basic thing that i need to know :
1. how to transfer data between tapestry class and my javascript library
a. from javascript to tapestry page class
b. from page class to javascritp

2. How to invoke
a. javascript from tapestry class
b. tapestry class from javascript.

well so far the answers is :
1a. The easiest way was to create a hidden variable that could be accessed from the class.
1b. Is by returning a JSON object that being invoked by javascript. Something more or less like this,

public JSONArray getArea() {
System.out.println("=== Getting area in javascript ");

List areaMarkers = areaEngine.getAllAreaMarkers();
return jsonProcessor.marshal(areaMarkers);

}


Well for the other two is blank for me :(, I'll update this if i have the answer.

~FD

No comments: