I'm a little behind on the latest code, using Tap3 at my office, but I think the principles are the same. Tapestry uses a template system to dynamically generate javascript code that includes references to names and values generated by your java code. You need to use a Shell component to get your Javascript written to the correct place in the HTML document, inside the head tag/element. And you need to encase your JS inside a *.script file which is an xml document instructing Tapestry what to do with the different code blocks and replacement of values. If you grok the above, you can probably search the archives for some pointers on the format of *.script files and how to bind objects from Java to Javascript. Best of luck! </bd>
________________________________ From: glanzel [mailto:[EMAIL PROTECTED] Sent: Sat 7/8/2006 9:24 AM To: Tapestry users Subject: javascript to tapestry hi i got a question on how to add javascript to tapestry. i try to add an google maps site to my webapplication, and therefor i need to generate an javscript array from tapestry. my idea - because i found nothing better - was to generate javascript sourcecode inside in Java an then add this javscript code to the html page. like this: public class GhotspotMap extends BasePage{ String address; public GhotspotMap(){ getHotspotData(); } public void getHotspotData() { Vector<Nas> gm = Model.getModel().getAllNas(); for (int i = 0; i < gm.size();i++){ Nas nas = gm.get(i); String jstring = "points["+i+"] = "+nas.street+" "+nas.number+" "+nas.postalCode; Body body = (Body) this.getBody(); body.addBodyScript(jstring); } } } but for some resons i didnt even get a Body Object from the BaseBage. (because getBody return IRender Objects) can you tell me if my way to gut javascript to the html page could work, and maybe how, or which is the right way to add an javascript array read from the database? thanks a lot - grischan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]