Generate clientside Javascript from Java