Actually, you can just put the JavaScript in a .js file and then include
it with @IncludeJavaScriptLibrary. Then add a call to
RenderSupport#addScript in your page's afterRender handler that does the
setup you need.
For this and more, check
http://tapestry.apache.org/tapestry5/tapestry-core/guide/ajax.html.
-Filip
On 2008-06-25 13:46, kranga wrote:
One more addition: When including the flash player in a page, the
recommended technique is to put inline javascript that renders the flash
player where the javascript appears in the page. The javascript relies
on an external javascript file being included. If I do an asset
injection of the Flash javascript, it ends up at the bottom of the page
and the flash player inline javascript fails. So it seems like one would
need to override this behavior. Otherwise I'd have to package up the
inline javascript as a method, inject that and then call it in place.
But I'm concerned with putting all the javascript for the flash in a
Java file. That is not a natural fit.
I have some questions regarding the decision to render Javascript at
the end of the document:
1) What was the rationale/dirver for this?
2a) The upgrade notes say to use RenderSupport. Can anyone provide a
short description of how to use RenderSupport to inject a simple
javascript function?
2b) This implies that a lot of inline javascript will have to be moved
from .tml to .java classes. It seems this will reduce the
"naturalness" of being able to use javascript normally.
---------------------------------------------------------------------
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]