I am writing a google maps component which can display markers on a map, each marker has an info window when it is clicked on. I'd like to pass a parameter to the component containing the tml to render each marker's info window.
eg: Page.java ======== @InjectComponent @Property GoogleMap mygooglemap public List<GoogleMapMarker> getMarkers() { ... } Page.tml ============ <t:googlemap markers="markers" t:id="mygooglemap"> <p:infowindow> <div style="infowindow-title">${mygooglemap.currentmarker.data.title}</div> <div style="infowindow-body">${mygooglemap.currentmarker.data.body}</div> </p:infowindow> </t:googlemap> The only thing is that the google maps api wants each marker's infowindow html to be a javascript string so I somehow need to use tapestry's template engine to generate strings for each marker's infowindow which I can then use to generate javascript. I have seen that the new Tree component can accept a "label" property which allows the user to provide a custom template for rendering each label. The label parameter is of type RenderCommand and RenderCommand has a single method: void render(MarkupWriter writer, RenderQueue queue); So, I was hoping that I could do the same sort of thing except that instead of rendering to the response MarkupWriter, I could pass an empty MarkupWriter to this method and then extract the generated markup somehow into a string to then use it to generate my javascript. Has anyone done this sort of thing before? Am I on the right track or is there a simpler way?